Place a moving cursor along line series

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

endorphing wrote at 2013-01-06 23:17:

First off, thanks for OxyPlot -- its the best charting library for WPF/Silverlight out there today! 

I have a scenario where I need a small "dot" moving along a plotted line, as I move my cursor in the chart area. Basically, I need to display the co-ordinates at that dot in a label somewhere. 

This example by Telerik captures this well, 

http://demos.telerik.com/silverlight/#ChartView/Annotations

Is there something in OxyPlot that already does this? If not, what would be the best way to achieve this? 

Thanks in advance for your help. 


objo wrote at 2013-01-12 18:16:

You can write a custom 'tracker' (see example Source\Examples\WPF\WpfExamples\Examples\CustomTrackerDemo), but currently the tracker is only shown after the left mouse button has been pressed down. See also http://oxyplot.codeplex.com/workitem/9963, I think this feature is what you are looking for. Give it a vote! :)

You can also add a RectangleAnnotation (EllipseAnnotation is not yet available) to the plot, and handle the MouseMoved event of the PlotModel or the WPF/Silverlight.Plot control, but then you need to calculate and update the position of the annotation yourself.


endorphing wrote at 2013-01-14 19:49:

Thanks, I'll try the RectangleAnnotation/MouseMoved approach you described. I also gave the work item a vote. 

I had another related tracker question. My scenario is as follows: 

  1. I have two separate plots that share a common Axis, i.e., I have (X,Y,Z), and am plotting X-Y & Y-Z.
  2. When I track the first plot at a Y location, I need to automatically show a tracker at the corresponding Y in the second plot. This is to visualize the association between X & Z. 

What's the best way to do this? MouseMoved wouldn't help here, since there is no mouse over the second plot. One option might be to have the tracker bind to a point, and show up anytime it is not null.

Appreciate any suggestions. 


objo wrote at 2013-01-15 07:29:

I think writing a custom tracker would be the best solution to solve you other tracker. I don't think I will add more features into the existing tracker control (I am a bit concerned about 'feature bloat' in this library...)