.NET, WPF, DXCharts for WPF
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CS
VB
.gitattributes
.gitignore
LICENSE
Readme.md
config.json

Readme.md

How to display a crosshair cursor on a chart control

Note: This example applies to a DXCharts version prior to v2012 vol 1. Starting from v2012 vol 1, a crosshair cursor is provided out-of-the-box and is enabled by default for all XY-series views.

In some cases, you may need to analyze how data is changing on a chart. This can be easily done using a crosshair cursor.

The following example demonstrates how to display a crosshair cursor on the LineSeries2D chart and show the current series coordinates on the crosshair labels.

Description

To accomplish this task, you need to convert mouse coordinates to diagram coordinates and vice versa using the XYDiagram2D.PointToDiagram and XYDiagram2D.DiagramToPoint methods accordingly.

After the coordinate transformation is done, it becomes possible to draw the crosshair cursor on the diagram and do other required customizations that are shown in code.