Pergunta

I ended up using DDD as my main charting for WPF. Need to implement crosshair (two lines which follow mouse pointer).

Which particular class in DDD is the best to override?

EDIT : actually I discovered that there is already element which does what I need. Just add this into the Plotter XAML.

<ddd:CursorCoordinateGraph/>
Foi útil?

Solução

To keep this question for information purpose I am going to answer it myself.

Apparently DDD already has crosshair. To enable this you need to :

<ddd:ChartPlotter>
...            
    <ddd:CursorCoordinateGraph/>
...
</ddd:ChartPlotter>

Outras dicas

I am not aware whether or not this functionality is available in the DDD controls.

You could put the control in a grid and add a sibling:

<Grid>
    <Chart />
    <Canvas />
</Grid>

Now you can track the movement of the mouse above the canvas and simply draw two lines in the canvas.

Even nicer would be to add two lines to the canvas and translating them to the mouse position.

Make sure you disable hit testing on the canvas and its lines you you are still able to manipulate the chart.

Also: make sure you bind the Canvas's size to the size of the Chart or the mouse position will be wrong.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top