Nevron Open Vision Documentation
Scales / Value Snapping
In This Topic
    Value Snapping
    In This Topic

    Several objects in the chart object model have the ability to snap to certain values on the scales / axes they are displayed on. These objects include interactivity tools like the NRectangleZoomTool and NAxisCursorTool as well as NIndicator derived gauge objects.

    The value snapping functionality is controlled through an instance of an object deriving from the abstract NValueSnapper class. The following table shows the possible value snapper objects and how they snap values to a chart or gauge axis:

    Class Description
    NAxisMajorTickSnapper Snaps values to the major ticks of the axis
    NAxisMinorTickSnapper Snaps values to the minor ticks of the axis
    NAxisRulerClampSnapper Clamps values to the axis min / max values
    NAxisRulerMinMaxSnapper Snaps values to the axis min / max values
    NNumericValueSnapper Represents a value snapper that snaps values to the nearest step from a specified origin.
    NDateTimeValueSnapper Represents a value snapper that snaps date/time values to the nearest date time step from a specified date/time origin.

    The following code shows how to implement a radial gauge needle indicator snapping to the nearest value with step 5 – for example 0, 5, 10 etc.

    C#
    Copy Code

    NNeedleValueIndicator needle = new NNeedleValueIndicator();
    needle.AllowDragging =
    true;
    needle.ValueSnapper =
    new NNumericValueSnapper(5);
    radialGauge.Indicators.Add(needle);