Skip to main content Skip to footer

How to add complex ranges to a gauge?

The ComponentOne WPF Gauges library supports layering multiple decorators to create complex gauge designs with a rotating needle and labels. This example below shows how to create the following gauge:

WPF Gauge
 <Grid>
        <c1:C1RadialGauge FaceBrush="#0F161D" SweepAngle="360" Thickness="1" StartAngle="120" Minimum="0" Maximum="100" AutoScale="False">
</c1:C1RadialGauge>
            <c1:C1RadialGauge x:Name="gauge1" Background="#00000000" FaceBrush="#00000000" SweepAngle="300" Thickness="1" StartAngle="120" Minimum="0" Maximum="100" ShowRanges="True" MinFontSize="0.1" MaxFontSize="0.1" AutoScale="False" Value="85">
            <c1:C1RadialGauge.Pointer>
                <c1:GaugeRange Thickness="0.5" />
            </c1:C1RadialGauge.Pointer>
            <c1:C1RadialGauge.Decorators>
                <c1:GaugeRange From="0" To="25" Brush="#58131C" Thickness="0.35" Location="0.63"/>
                <c1:GaugeRange From="25" To="50" Brush="#464D27" Thickness="0.3" Location="0.68"/>
                <c1:GaugeRange From="50" To="90" Brush="#0A371A" Thickness="0.25" Location="0.73"/>
                <c1:GaugeRange From="90" To="95" Brush="#464D27" Thickness="0.3" Location="0.68"/>
                <c1:GaugeRange From="95" To="100" Brush="#58131C" Thickness="0.35" Location="0.63"/>
                <c1:GaugeMark Brush="White" Thickness="0.12" Width="3" Interval="20" Location="0.55" Alignment="Center"/>
                <c1:GaugeMark Brush="White" Thickness="0.12" Width="1" Interval="10" Location="0.55" Alignment="Center"/>
                <c1:GaugeLabel Brush="White" Interval="20" Thickness="0.12" Location="0.85" />
                <c1:GaugePointer Thickness="0.9" Location="-0.2" Width="10">
                    <c1:GaugePointer.Brush>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#A81E1E"/>
                            <GradientStop Color="#FF440000" Offset="2"/>
                        </LinearGradientBrush>
                    </c1:GaugePointer.Brush>
                </c1:GaugePointer>
            </c1:C1RadialGauge.Decorators>
        </c1:C1RadialGauge>
        <Ellipse Width="25" Height="25" Fill="#607294">
            <Ellipse.Effect>
                <DropShadowEffect ShadowDepth="17" BlurRadius="15" Opacity="0.3"/>
            </Ellipse.Effect>
        </Ellipse>
</Grid>