The DataCursor class triggers on mouse button clicks, not mouse movement.
The easiest way to do what you describe is to add a mouse move event to the ChartView class a design time. Just double click on your ChartView derived class in the Solution Explorer to bring it up in Design Mode. In the Solution Explorer, under Properties, select the Event icon (lightning bolt) and double click the MouseMove event. That adds the shell of a mouse move event (DataCursors_MouseMove in the example below) to your ChartView derived class. Then just add code similar to what we show to get the current position of the mouse and convert it to physical coordinates, using ConvertCoord. Convert the (x,y) values to a string and assign it to a simple Systems.Windows.Forms.Label object, which has been previously added to the ChartView using the designer. In the example below, the pTransform1 variable is the CartesianCoordinates object used to display the chart, made global to the entire class.
.
.
private Label label1;
CartesianCoordinates pTransform1;
public DataCursors()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitializeComponent call
InitializeChart();
}
private void InitializeChart()
{
.
.
.
pTransform1 = new CartesianCoordinates( ChartObj.LINEAR_SCALE, ChartObj.LINEAR_SCALE);
pTransform1.AutoScale(datasetarray, ChartObj.AUTOAXES_FAR, ChartObj.AUTOAXES_FAR);
.
.
.
}
private void DataCursors_MouseMove(object sender, MouseEventArgs e)
{
Point2D mousepoint = new Point2D(e.X, e.Y);
Point2D p = pTransform1.ConvertCoord(ChartObj.PHYS_POS, mousepoint, ChartObj.DEV_POS);
String s = "x= " + p.X.ToString() + " y= " + p.Y.ToString();
label1.Text = s;
}