Nevron Open Vision Documentation
Chart / Interactivity / Axis Cursors
In This Topic
    Axis Cursors
    In This Topic

    The axis cursor feature of the control allows you to highlight the current mouse coordinates projected on a pair of horizontal and vertical axes.

    Axis Cursor Tool

    You enable the axis cursor feature by adding an object of type NAxisCursorTool to the interactor of the chart:

    Copy Code

    NInteractor interactor = new NInteractor();

    NAxisCursorTool axisCursorTooll = new NAxisCursorTool();

    axisCursorTooll.Enabled = true;


    chart.Interactor = interactor;

    Mouse Coordinate Snapping

    In order to snap the mouse coordinate to the nearest tick or round value you can assign a value snapper to the axis cursor tool. The following code snippet shows how to assign horizontal and vertical snapping to the axis cursor tool:

    Copy Code

    axisCursorTooll.HorizontalValueSnapper = new NNumericValueSnapper(5);

    axisCursorTooll.VerticalValueSnapper = new NNumericValueSnapper(5);

    Check out the Value Snapping topic for more information on different value snapper objects.

    Changing the Reference Axes

    By default the axis cursor tool will show axis cursors on the primary Y and primary X axes - if  you wish to change this you need to assign a different axis to the HorizontalAxis or VerticalAxis properties of the tool:

    Copy Code

    axisCursorTooll.VerticalAxis = someYAxis;

    axisCursorTooll.HorizontalAxis = someXAxis;

    Intercepting the Value Changed Events

    The axis cursor tool has two events that allow you to track the horizontal and vertical axis cursor value changes:

    Copy Code

    axisCursorTool.HorizontalValueChanged += new Function<NValueChangeEventArgs>(axisCursorTooll_HorizontalValueChanged);


    void axisCursorTool_HorizontalValueChanged(NValueChangeEventArgs arg)


    NAxisCursorTool tool = (NAxisCursorTool)arg.TargetNode;

    // tool.HorizontalValue hold the horizontal cursor value


    Axis Cursor Update

    By default the horizontal and vertical axis cursor values will be updated when the mouse moves over the chart. This is controlled from the UpdateOnMouseMove property, which is set to true initially - in order to disable this bahavior you can set this property to false:

    Copy Code

    axisCursorTooll.UpdateOnMouseMove = false;

    If you wish the mouse cursors to update on specific mouse button events (in response to user mouse clicks on the chart) you can use the UpdateMouseButtonEvents that exposes a bit mask allowing you to track different mouse events - for example:

    Copy Code

    axisCursorTooll.UpdateMouseButtonEvents = ENMouseButtonEvent.LeftButtonDown | ENMouseButtonEvent.RightButtonDown;

    Now the cursors will update in response to a left or right mouse button.

    Automatic Cursors Visibility

    By default axis cursors will be visible only when the mouse hovers over the chart. When it leaves the chart content area axis cursors are automatically hidden. This feature can be turned off using the AutoHideCursors property:

    Copy Code

    axisCursorTooll.AutoHideCursors = false;