Syncing trackers in multiple plots (Metro)

Nov 1, 2013 at 12:13 PM
Edited Nov 1, 2013 at 12:13 PM
Hi all,

I'm working with the Oxyplot.Metro version, and have a xaml with 3 plots in the same column.
They all have the same X values. The standard metro plots show a tracker upon mouse down.

I have already overwritten the GetNearestPoint function of the LineSeries to allow returning the Y value of a mouse click, not just the nearest point. My goal is to show a tracker on each of the 3 plots, when there is only a mouse click on one of them. But since the x axes are the same and I know the X value, this should not be so hard.

However, I'm having multiple issues with this.
I've tried:
PlotModel1.MousePressed += (s, e) =>
{
    // Do some stuff to show tracker on Plot2 and Plot3
};
and a lot more stuff in this MousePressed event, however when I debug, the event is never thrown. Probably due to Metro stuff?

I also tried some things like
Plot1.PointerPressed += (s, e) =>
{
    PlotModel2.HandleMouseDown(s, e);
};
But again, debugger never reaches this code. The plots are defined in the XAML, and this code is in the constructor of the cs file behind the XAML.

Could somebody help or explain why this won't work?

Thanks in advance!

Thomas
Nov 1, 2013 at 6:02 PM
I'm not sure, but you should try the myLineSeries.MousePressed event instead, and e.Handled at the end. Good luck.
Nov 1, 2013 at 6:21 PM
I just tried this simple stub:
LineSeries1.MouseDown += (s, e) =>
{
    // some stuff with plot2 and plot3
    e.Handled = true;
};
with a breakpoint in it, but once again it never breaks so the event is never handled.
Why does each of these things (series, plotmodels, plot) have their own mouse-events that never seem to be emitted?
I have really no idea why I can't get this to work, because the code looks rather self-explanatory...
Coordinator
Nov 4, 2013 at 7:50 AM
Are you using the latest version? The mouse events were added quite recently for the 'metro' version.
Marked as answer by thomasstockx on 11/4/2013 at 1:14 AM
Nov 4, 2013 at 9:16 AM
objo wrote:
Are you using the latest version? The mouse events were added quite recently for the 'metro' version.
Oh, seems like I was working with a month old version, my bad. I had no idea they weren't in the metro version yet.
Thanks!