Hi All!
Maybe a simple question, but I found no solution: If I click on the Chart how can I ask for the coordinates where I clicked to (based on the TChart axis)? I want to catch coordinates directly from the chart, the user should simply click on the chart... (independent of series)
Thanks in advance!
Best regards
Alex
How to get the coords where I clicked on the TChart?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Alex,
Yes, you can use something like:
Yes, you can use something like:
Code: Select all
private void tChart1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
tChart1.Header.Text=e.X.ToString()+", "+e.Y.ToString();
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
thanks for the hint. This returns the absolute values in pixel on the TChart. Using this, and the .axes.IStartPos / .IEndPos, I can scale the pixels to relative chart coordinates.
By the way: is there a way to directly get the coordinates related to the Chart-axis without this additional subroutine? (e.g. using the cursor tool)
Thanks!
Alex
thanks for the hint. This returns the absolute values in pixel on the TChart. Using this, and the .axes.IStartPos / .IEndPos, I can scale the pixels to relative chart coordinates.
By the way: is there a way to directly get the coordinates related to the Chart-axis without this additional subroutine? (e.g. using the cursor tool)
Thanks!
Alex
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Alex,
Yes, you are right. You can use Cursor Tool for this, just have a look at the TeeChart features demo included with the installation, in the TeeChart program group an search for the cursor tool examples.
Yes, you are right. You can use Cursor Tool for this, just have a look at the TeeChart features demo included with the installation, in the TeeChart program group an search for the cursor tool examples.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
I've found the internal Chart-method to convert the e.x and e.y of the mouse-down-event:
The help isn't really correct, but it works (same description as CalcPosValue, difference only in the function syntax).
Thanks!
Alex
I've found the internal Chart-method to convert the e.x and e.y of the mouse-down-event:
Code: Select all
posx = TChart1.Axes.Bottom.CalcPosPoint(e.X)
posy = TChart1.Axes.Left.CalcPosPoint(e.Y)
Thanks!
Alex