Instrumentation > Gauges > Indicators > Marker Indicator |
In order to add a marker indicator to a gauge you need to create an instance of the NMarkerValueIndicator class and then add it to the Indicators collection of the gauge.
In order to create a marker indicator you must first create an instance of the NMarkerValueIndicator class and then add it to the Indicators collection of the radial gauge:
C# |
Copy Code
|
---|---|
NMarkerValueIndicator markerValueIndicator = new NMarkerValueIndicator(); someGauge.Indicators.Add(markerValueIndicator); |
C# |
Copy Code
|
---|---|
markerValueIndicator.Value = 10; |
The marker shape and appearance are controlled through the Shape property exposed by the NMarkerValueIndicator class. This property accepts a 2D Smart Shape definition that you can create either standalone or use some of the predefined 2D smart shapes exposed from the N2DSmartShapeFactory class. By default the maker will use a triangular smart shape definition, but you can change this by simply creating a new smart shape and assigning it to the Shape property of the indicator.
The following code will change the marker shape to bar:
C# |
Copy Code
|
---|---|
markerValueIndicator.Shape = ENScaleValueMarkerShape.Bar; |
Marker appearance is controlled through the Fill and Stroke properties. The following code will change the marker filling and stroke to dark green:
C# |
Copy Code
|
---|---|
markerValueIndicator.Fill = new NColorFill(NColor.DarkGreen); markerValueIndicator.Stroke = new NStroke(1.0, NColor.DarkGreen); |
The marker size is controlled by the Width and Height properties exposed by the NMarkerValueIndicator class. The following code will make the value indicator bigger:
C# |
Copy Code
|
---|---|
markerValueIndicator.Width = 20; markerValueIndicator.Height = 20; |