Xceed Chart for WinForms v4.4 Documentation
DataCursorChange Event
Example 


Xceed.Chart.Core.v4.4 Assembly > Xceed.Chart.Core Namespace > DataCursorTool Class : DataCursorChange Event
This event is triggered when data cursor synchronization occurs.
Syntax
'Declaration
 
Public Event DataCursorChange As EventHandler
'Usage
 
Dim instance As DataCursorTool
Dim handler As EventHandler
 
AddHandler instance.DataCursorChange, handler
public event EventHandler DataCursorChange
Remarks
The event args object is of type DataCursorToolEventArgs containing the mouse coordinates expressed in the coordinate system of the selected horizontal and vertical axes.
Example
The following example shows how to track the mouse position in axis coordinates:
Dim dataCursorTool As DataCursorTool =  New DataCursorTool() 
AddHandler dataCursorTool.DataCursorChange, AddressOf OnDataCursorChange
dataCursorTool.DataCursorMode = DataCursorMode.MouseMove
ChartControl.InteractivityOperations.Add(dataCursorTool)
 
Private  Sub OnDataCursorChange(ByVal sender As Object, ByVal eventargs As EventArgs)
   Dim dcea As DataCusorToolEventArgs = CType(eventargs, DataCusorToolEventArgs)

   XAxisTextBox.Text = dcea.HorizontalAxisValue.ToString("0.00")
   YAxisTextBox.Text = dcea.VerticalAxisValue.ToString("0.00")
End Sub
DataCursorTool dataCursorTool = new DataCursorTool();
dataCursorTool.DataCursorChange += new EventHandler(OnDataCursorChange);
dataCursorTool.DataCursorMode = DataCursorMode.MouseMove;
ChartControl.InteractivityOperations.Add(dataCursorTool);

 private void OnDataCursorChange(object sender, EventArgs eventargs)
 {
   DataCusorToolEventArgs dcea = (DataCusorToolEventArgs)eventargs;

   XAxisTextBox.Text = dcea.HorizontalAxisValue.ToString("0.00");
   YAxisTextBox.Text = dcea.VerticalAxisValue.ToString("0.00");
 }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DataCursorTool Class
DataCursorTool Members