Syncing trackers in multiple plots (Metro)

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

thomasstockx wrote at 2013-11-01 12:13:

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

everytimer wrote at 2013-11-01 18:02:

I'm not sure, but you should try the myLineSeries.MousePressed event instead, and e.Handled at the end. Good luck.

thomasstockx wrote at 2013-11-01 18:21:

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

objo wrote at 2013-11-04 07:50:

Are you using the latest version? The mouse events were added quite recently for the 'metro' version.

thomasstockx wrote at 2013-11-04 09:16:

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!