|
Get X,Y Values without Setting Image Map |
Posted by Amal V R on Apr-27-2011 12:24 |
|
Hi Peter,
You have already mentioned in a reply to my query that creating image map is time consuming.Is there any means by which we can take the X,Y values of the graph without setting image map; some methods to get the values so that I can display it on mouse event.
Please help me.
Thanks and Regards
Amal V R |
Re: Get X,Y Values without Setting Image Map |
Posted by Peter Kwan on Apr-28-2011 00:24 |
|
Hi Amal,
Yes. You can always get the (x, y) values. However, the key is what (x, y) values you want to get.
For a point with data value (x, y), you can get its mouse (x, y) coordinates using Layer.getXCoor and Layer.getYCoor (or XYChart.getXCoor and XYChart.getYCoor).
If you just want to get the axis (x, y) values of a point under the mouse cursor (the mouse cursor does not need to point to a real data point - it may just point to some empty position in the plot area), you may use simple interpolation to determine the axis values. See:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1187910016#N1187953452
Note that a "hot spot" for the data representation is not a point. It is a region (a polygon). The exact shape depends on the graphical data representation you are using. For example, the shape for a bar, a pie slice (for pie charts), a line segment (for line charts), a symbol (for scatter charts) are all different. You may get the geometric shape of a hot spot by parsing the image map generated by ChartDirector.
Although creating the image map may be slow for tens of thousands of points, it may not matter in a Windows Forms application (unless it is really very very slow). It is because:
(a) Your code do not need the image map at all unless the user really moves the mouse over the image. So you may delay the image map generation until the mouse is actually over the image (by using the mousemove event).
(b) You can always generate the image map in a background thread, and use the foreground thread for the chart image. So the chart image will display quickly without having to wait for the image map. The user may not notice that the image map is active only sometime later.
Hope this can help.
Regards
Peter Kwan |
Re: Get X,Y Values without Setting Image Map |
Posted by Amal V R on Apr-28-2011 13:56 |
|
Thank you Peter..... |
|