Applies to: Nevron Chart for .NET (Gauge for .NET)

How to configure the gauge range indicators?

Range indicators are useful when you have to highlight important ranges of data on the gauge axis. Furthermore range indicators can have different begin and end width that can be used to visually highlight the importance of different values within the range.



The following example demonstrates how to configure and create range indicator sections:

[C#]
// create range indicator sections
CreateSection(radialGauge, scale, Color.Green, new NRange1DD(0, 30));
CreateSection(radialGauge, scale, Color.Yellow, new NRange1DD(30, 70));
CreateSection(radialGauge, scale, Color.Red, new NRange1DD(70, 100));
...
private void CreateSection(NRadialGaugePanel radialGauge, NStandardScaleConfigurator scale, Color color, NRange1DD range)
{
    // add range indicator
    NRangeIndicator indicator = new NRangeIndicator();
    indicator.Value = range.End;
    indicator.OriginMode = OriginMode.Custom;
    indicator.Origin = range.Begin;
    indicator.FillStyle = new NColorFillStyle(Color.FromArgb(225, color));
    indicator.StrokeStyle = new NStrokeStyle(0);
    indicator.OffsetFromScale = new NLength(-20);
    indicator.BeginWidth = new NLength(9);
    indicator.EndWidth = new NLength(9);
    indicator.PaintOrder = IndicatorPaintOrder.BeforeScale;
    radialGauge.Indicators.Add(indicator);
}

[VB.NET]
' create range indicator sections
CreateSection(radialGauge, scale, Color.Green, New NRange1DD(0, 30))
CreateSection(radialGauge, scale, Color.Yellow, New NRange1DD(30, 70))
CreateSection(radialGauge, scale, Color.Red, New NRange1DD(70, 100))
...
Private Sub CreateSection(radialGauge As NRadialGaugePanel, scale As NStandardScaleConfigurator, color__1 As Color, range As NRange1DD)
    ' add range indicator
    Dim indicator As New NRangeIndicator()
    indicator.Value = range.[End]
    indicator.OriginMode = OriginMode.[Custom]
    indicator.Origin = range.Begin
    indicator.FillStyle = New NColorFillStyle(Color.FromArgb(225, color__1))
    indicator.StrokeStyle = New NStrokeStyle(0)
    indicator.OffsetFromScale = New NLength(-20)
    indicator.BeginWidth = New NLength(9)
    indicator.EndWidth = New NLength(9)
    indicator.PaintOrder = IndicatorPaintOrder.BeforeScale
    radialGauge.Indicators.Add(indicator)
End Sub

You can also use gradient fill style in order to achieve smooth effect on the range sections:



[C#]
// create range indicator sections
CreateSection(radialGauge, scale, Color.Green, Color.Yellow, new NRange1DD(0, 30));
CreateSection(radialGauge, scale, Color.Yellow, Color.Orange, new NRange1DD(30, 70));
CreateSection(radialGauge, scale, Color.Orange, Color.Red, new NRange1DD(70, 100));
...
private void CreateSection(NRadialGaugePanel radialGauge, NStandardScaleConfigurator scale, Color beginColor, Color endColor, NRange1DD range)
{
    // add range indicator
    NRangeIndicator indicator = new NRangeIndicator();
    indicator.Value = range.End;
    indicator.OriginMode = OriginMode.Custom;
    indicator.Origin = range.Begin;
    indicator.FillStyle = new NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, beginColor, endColor);
    indicator.StrokeStyle = new NStrokeStyle(0);
    indicator.OffsetFromScale = new NLength(-20);
    indicator.BeginWidth = new NLength(9);
    indicator.EndWidth = new NLength(9);
    indicator.PaintOrder = IndicatorPaintOrder.BeforeScale;
    radialGauge.Indicators.Add(indicator);
}

[VB.NET]
' create range indicator sections
CreateSection(radialGauge, scale, Color.Green, Color.Yellow, New NRange1DD(0, 30))
CreateSection(radialGauge, scale, Color.Yellow, Color.Orange, New NRange1DD(30, 70))
CreateSection(radialGauge, scale, Color.Orange, Color.Red, New NRange1DD(70, 100))
  
Private Sub CreateSection(radialGauge As NRadialGaugePanel, scale As NStandardScaleConfigurator, beginColor As Color, endColor As Color, range As NRange1DD)
    ' add range indicator
    Dim indicator As New NRangeIndicator()
    indicator.Value = range.[End]
    indicator.OriginMode = OriginMode.[Custom]
    indicator.Origin = range.Begin
    indicator.FillStyle = New NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, beginColor, endColor)
    indicator.StrokeStyle = New NStrokeStyle(0)
    indicator.OffsetFromScale = New NLength(-20)
    indicator.BeginWidth = New NLength(9)
    indicator.EndWidth = New NLength(9)
    indicator.PaintOrder = IndicatorPaintOrder.BeforeScale
    radialGauge.Indicators.Add(indicator)
End Sub

Article ID: 121, Created On: 11/9/2010, Modified: 12/1/2010