This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Jason, You might recall I was trying to get the tracking element to work when you can have multiple y values on a graph. We did not include this feature in our release as it was not working properly. We hope to bring this feature back in for the next release version. I have attached the sample project I had been using to try and get the algorithm to work however I am wondering if you could please help with this. I want to be able to get the ellipsis on the closest point to where the mouse is not just based on the x position as demonstrated in the attached project. Thanks. Kamal |
|
|
Hello Kamal To get the closest point on the curve to the mouse, you can use some simple vector geometry to find the closest point on each line segment to the mouse. (A line segment is an adjacent pair of points in your data). After this has been done for all line segments, you find which one produced the closest point to the mouse and that is the result. Here are static helper methods I've written for you which do this vector geometry:
Now you can replace the InterpolatePoint method in TrackingElement with the following implementation which uses the vector geometry helpers:
The tricky part to understand here is to create a ratio based on the ranges of the X and Y axes. This ratio is used to multiply the Y value of all the points before performing the vector geometry, and then dividing the Y value of the final result. This is to "stretch" the data so that the X and Y "units" are the same which is necessary for the vector geometry to work. Let me know if you have further questions about this. Jason Fauchelle |
|