0

I've tried to add the following events:

  • MouseDoubleClick
  • TouchEvent
  • MouseDown

All of them leads to the same event that should fire a MessagBox (just for debug) but nothing happens. I guess I don't have the right event... but which one is it if I want to catch the event when the user is clicking on a point in a LineSeries in my chart?

<oxy:Plot Grid.Column="0" Name="Plot" Title="Errors" MouseDown="Plot_MouseDown">            
    <oxy:Plot.Axes>
        <oxy:LinearAxis Position="Left" 
                MajorGridlineStyle="Solid" 
                MinorGridlineStyle="Dash" />
        <oxy:DateTimeAxis Position="Bottom" 
                MajorGridlineStyle="Solid" 
                MinorGridlineStyle="Dash" />                
    </oxy:Plot.Axes>
    <oxy:LineSeries ItemsSource="{Binding ErrorsByMinute}" DataFieldX="DateTime" 
                DataFieldY="Value" MarkerType="Circle" MarkerFill="#336699" 
                MarkerSize="4" Color="#336699" MouseDoubleClick="Plot_MouseDown" 
                TouchEnter="LineSeries_TouchDown" MouseDown="Plot_MouseDown" />
</oxy:Plot>        
Noctis
  • 11,507
  • 3
  • 43
  • 82
Jason94
  • 13,320
  • 37
  • 106
  • 184
  • What is Plot? Is HitTesting enabled? Check the value of IsHitTestVisible property. – dev hedgehog Oct 25 '13 at 08:36
  • It is enabled, when I click the chart i get a label. – Jason94 Oct 25 '13 at 08:38
  • There are two events in wpf which must deal with mouse buttons. They are called PreviewMouseLeftButtonDown and MouseLeftButtonDown. Every other event like Click or DoubleClick is just a derivation from those two. Try it out with them. :) – dev hedgehog Oct 25 '13 at 08:42

1 Answers1

1

You're having them in the wrong place ... they should be on the Plot, not the LineSeries.

Try this:

<oxy:Plot Grid.Column="0" Name="Plot" Title="Errors" MouseDown="Plot_MouseDown" 
    MouseDoubleClick="Plot_MouseDown" 
    TouchEnter="LineSeries_TouchDown" 
    MouseDown="Plot_MouseDown"
>            
    <oxy:Plot.Axes>
        <oxy:LinearAxis Position="Left" MajorGridlineStyle="Solid" MinorGridlineStyle="Dash" />
        <oxy:DateTimeAxis Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Dash" />                
    </oxy:Plot.Axes>
    <oxy:LineSeries ItemsSource="{Binding ErrorsByMinute}" DataFieldX="DateTime" DataFieldY="Value" MarkerType="Circle" MarkerFill="#336699" MarkerSize="4" Color="#336699"  />
</oxy:Plot>
Noctis
  • 11,507
  • 3
  • 43
  • 82