I've already done a search but couldn't find what I wanted...
I have a cursor tool which I have as 'invisible' (its colour is transparent), so that it can send the X and Y via an Event so that you are constantly updated with the X and Y of the chart (not control).
However I wanted to replace this with a FastCursor (so setting the property to true), but that doesn't like my transparent colour, and so draws the line as black.
Is there any other way of retrieving the X and Y of the mouse in the chart without using a Cursor Tool - I like having the CursorTool because you can retrieve both chart and control X and Y but it slows the chart down a bit with redrawing.
Thanks for any help.
Regards
Chris
getting x and y coordinates of mouse
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Chris,
Yes, you can use TChart's MouseMove event and its e.X and e.Y arguments for getting mouse coordinates.
Hope this helps!
Yes, you can use TChart's MouseMove event and its e.X and e.Y arguments for getting mouse coordinates.
Hope this helps!
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 |
Thanks for the quick reply there Narcís.
I think I've got you, but I was wondering if there was another way to get the X and Y of the chart axis and not the chart (sorry I didn't put that in the first post), like the lowercase 'x' property of CursorChangeEventArgs, but just without using a CursorTool.
Thanks again,
Chris.
I think I've got you, but I was wondering if there was another way to get the X and Y of the chart axis and not the chart (sorry I didn't put that in the first post), like the lowercase 'x' property of CursorChangeEventArgs, but just without using a CursorTool.
Thanks again,
Chris.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Chris,
Sorry, I should have understood that
In that case you can easily obtain axis values like this:
Sorry, I should have understood that
In that case you can easily obtain axis values like this:
Code: Select all
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
double xVal = tChart1.Axes.Bottom.CalcPosPoint(e.X);
double yVal = tChart1.Axes.Left.CalcPosPoint(e.Y);
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Chris,
No, this is because when FastCursor=true it uses DrawReversibleLine method for painting as I explained on this thread.
No, this is because when FastCursor=true it uses DrawReversibleLine method for painting as I explained on this thread.
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 |
No worries Narcís, I just wondered, that's all!
The reason I asked is that I constantly need to calculate the nearest point when you right click or are moving colourbands - I used a combination of the Interpolating Line series method and a slightly modified version of the code I found in this thread, but as I found the nearestpoint tool in the cursor itself I just use that now.
That same cursor tool sends its X and Y (of the axis) back to the form it's in via event, so i've got it doing a few things at once, which is great!
I just noticed that because of it re-drawing it was taking slightly longer to report back the X and Y of the axis, so I was just searching for some minor alternatives - I can't remove the "invisible" cursor though because it's handy in what I need!
Thanks for the help again.
Chris
The reason I asked is that I constantly need to calculate the nearest point when you right click or are moving colourbands - I used a combination of the Interpolating Line series method and a slightly modified version of the code I found in this thread, but as I found the nearestpoint tool in the cursor itself I just use that now.
That same cursor tool sends its X and Y (of the axis) back to the form it's in via event, so i've got it doing a few things at once, which is great!
I just noticed that because of it re-drawing it was taking slightly longer to report back the X and Y of the axis, so I was just searching for some minor alternatives - I can't remove the "invisible" cursor though because it's handy in what I need!
Thanks for the help again.
Chris