In This Topic
Gauge axes are represented by instances the NGaugeAxis class. By default each gauge will have only one axis, however you can add an unlimited number of axes to it's axes collection. The following sections discuss the most important properties of the gauge axis:
Range
The range property allows you to set the range of values displayed by the axis. The following code snippet shows how to set the range to [0, 200]:
C# |
Copy Code
|
gauge.Axes[0].Range = new NRange(0, 200);
|
Scale
The scale property gives you access to the axis scale object that controls how the scale is decorated and layout. Detailed information on how to program gauge and chart scales can be found in the Overview book in this documentation. By default gauge axes use linear scale - the following code snippet shows how to modify the major tick mode:
C# |
Copy Code
|
NLinearScale linearScale = (NLinearScale)gauge.Axes[0].Scale;
linearScale.MajorTickMode = ENMajorTickMode.CustomStep;
linearScale.CustomStep = 10;
|
Anchor
The gauge axis anchor property controls the position and orientation of gauge axes. There are two types of gauge axis anchors:
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.
The following code will create a new gauge axis docked at the top of the of the gauge:
C# |
Copy Code
|
NRadialGauge radialGauge = new NRadialGauge();
NGaugeAxis axis = new NGaugeAxis();
axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, 50, 100);
axis.Range = new NRange(50, 100);
radialGauge.Axes.Add(axis);
radialGauge.SweepAngle = new NAngle(270, NUnit.Degree);
|
The above code will result in the following gauge axis configuration: