Pregunta

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>        
¿Fue útil?

Solución

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>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top