Chart for .NET / User's Guide / Axes / Position / Gauge Axis Anchors
In This Topic
    Gauge Axis Anchors
    In This Topic

    Gauge axis anchor control the position and orientation of gauge axes in gauge model space. There are two types of gauge axis anchors:

    Type Description
    NDockGaugeAxisAnchor  Docks the axis to the top or bottom of the gauge model space.
    NModelGaugeAxisAnchor Positions the axis on a specified value in the gauge model space.

    Note: Both anchor types have a BeginPercent and EndPercent properties that allow you to define the start and end point along the X axis in gauge model coordinates. This allows you to have axes that cover a different range as shown by the code snippet below.
     Docking Gauge Axes

    The following code will create a new gauge axis docked at the top of the of the gauge:

    C#
    Copy Code
    nChartControl1.Panels.Clear();
    NRadialGaugePanel radialGauge = new NRadialGaugePanel();
    NGaugeAxis axis = new NGaugeAxis();
    axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 50, 100);
    axis.Range = new NRange1DD(50, 100);
    radialGauge.Axes.Add(axis);
    radialGauge.SweepAngle = 270; 
    nChartControl1.Panels.Add(radialGauge);
    
    Visual Basic
    Copy Code
    NChartControl1.Panels.Clear()
    Dim radialGauge As New NRadialGaugePanel
    Dim axis As New NGaugeAxis 
    axis.Anchor = New NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, True, 50, 100)
    axis.Range = New NRange1DD(50, 100)
    radialGauge.Axes.Add(axis)
    radialGauge.SweepAngle = 270 
    NChartControl1.Panels.Add(radialGauge)
    

    The above code will result in the following gauge axis configuration:


     Model Gauge Axis Anchors

    Alternatively you can position gauge axes at specified model coordinates. The following code will add a secondary axis to the gauge that is positioned at the gauge center in model space:

    C#
    Copy Code
    nChartControl1.Panels.Clear();
    NRadialGaugePanel radialGauge = new NRadialGaugePanel();
    NGaugeAxis axis = new NGaugeAxis();
    axis.Anchor = new NModelGaugeAxisAnchor(new NLength(0), VertAlign.Center, RulerOrientation.Left, 0, 100);
    radialGauge.Axes.Add(axis);
    radialGauge.SweepAngle = 270; 
    NChartControl1.Panels.Add(radialGauge);
    
    Visual Basic
    Copy Code
    NChartControl1.Panels.Clear()
    Dim radialGauge As New NRadialGaugePanel 
    Dim axis As New NGaugeAxis
    axis.Anchor = New NModelGaugeAxisAnchor(New NLength(0), VertAlign.Center, RulerOrientation.Left, 0, 100)
    radialGauge.Axes.Add(axis)
    radialGauge.SweepAngle = 270 
    NChartControl1.Panels.Add(radialGauge)
    

    This is how the gauge axes will look after the above code is executed:


     Related Examples

    Windows Forms: Gauge Gallery\Gauges\Axes

    Web Forms: Gauge Gallery\Gauges\Scales

     

    See Also