Place a moving cursor along line series

Jan 6, 2013 at 11:17 PM

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. 

Coordinator
Jan 12, 2013 at 6:16 PM

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.

Jan 14, 2013 at 7:49 PM

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. 

Coordinator
Jan 15, 2013 at 7:29 AM

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...)