Blazor Radial Gauge Overview

    The Blazor radial gauge component provides a number of visual elements, like a needle, tick marks, ranges, and labels, in order to create a predefined shape and scale. The IgbRadialGauge also has built-in support for animated transitions. This animation is easily customizable by setting the TransitionDuration property.

    Blazor Radial Gauge Example

    The following sample demonstrates how setting multiple properties on the same IgbRadialGauge can transform it to completely different radial gauge.

    Please refer to these topics on adding the IgniteUI.Blazor package.

    Afterwards you may start implementing the control by adding the following namespaces:

    @using IgniteUI.Blazor.Controls
    

    Component Modules

    The IgbRadialGauge requires the following modules:

    // in Program.cs file
    
    builder.Services.AddIgniteUIBlazor(typeof(IgbRadialGaugeModule));
    

    Usage

    The following code demonstrates how create a radial gauge containing a needle and three comparative ranges on the scale.

    <IgbRadialGauge Height="100%" Width="100%"
          MinimumValue="0" Value="25"
          MaximumValue="100" Interval="5" >
        <IgbRadialGaugeRange
              StartValue="0"
              EndValue="30"
              Brush="red">
        </IgbRadialGaugeRange>
        <IgbRadialGaugeRange
              StartValue="30"
              EndValue="60"
              Brush="Yellow" >
        </IgbRadialGaugeRange>
        <IgbRadialGaugeRange
              StartValue="60"
              EndValue="100"
              Brush="Green">
        </IgbRadialGaugeRange>
    </IgbRadialGauge>
    

    Backing

    The radial gauge component comes with a backing shape drawn behind the scale that acts as a background for the radial gauge.

    The backing element represents background and border of the radial gauge component. It is always the first element rendered and all the rest of elements such as needle, labels, and tick marks are overlay on top of it.

    The backing can be circular or fitted. A circular shape creates a 360 degree circle gauge while a fitted shape creates a filled arc segment encompassing the ScaleStartAngle and ScaleEndAngle properties. This can be set by setting the BackingShape property.

     <IgbRadialGauge Height="100%" Width="100%"
        BackingShape="RadialGaugeBackingShape.Fitted"
        BackingBrush="#FCFCFC"
        BackingOutline="DodgerBlue"
        BackingOversweep="5"
        BackingCornerRadius="10"
        BackingStrokeThickness="5"
        BackingOuterExtent="0.8"
        BackingInnerExtent="0.15"
    
        ScaleStartAngle="135"
        ScaleEndAngle="45"
        MinimumValue="0"
        MaximumValue="80"
        Value="50"
        Interval="10">
    </IgbRadialGauge>
    

    Scale

    The scale is visual element that highlights full range of values in the gauge which can be created by supplying MinimumValue and MaximumValue values. Together with backing, it defines overall shape of gauge. The ScaleStartAngle and ScaleEndAngle properties define bounds of arc of the scale. While, the ScaleSweepDirection property specifies whether the scale sweeps in clockwise or counter-clockwise direction. You can customize appearance of the scale by setting ScaleBrush, ScaleStartExtent, and ScaleEndExtent properties.

    <IgbRadialGauge
      ScaleStartAngle="135"
      ScaleEndAngle="45"
      ScaleBrush="DodgerBlue"
      ScaleSweepDirection="SweepDirection.Clockwise"
      ScaleOversweep="1"
      ScaleOversweepShape="RadialGaugeScaleOversweepShape.Fitted"
      ScaleStartExtent="0.45"
      ScaleEndExtent="0.575"
      MinimumValue="0"
      MaximumValue="80"
      Value="50"
      Interval="10">
    </IgbRadialGauge>
    

    Labels

    The radial gauge labels are visual elements displaying numeric values at a specified interval between values of the MinimumValue and MaximumValue properties. You can position labels by setting the LabelExtent property to a fraction, where 0 represents center of gauge and 1 represents outer extent of the gauge backing. Also, you can customize labels setting various styling properties such as FontBrush and Font.

    <IgbRadialGauge
      Height="100%" Width="100%"
      LabelInterval="10"
      LabelInterval="10"
      Font="11px Verdana"
      FontBrush="DodgerBlue"
      MinimumValue="0"
      MaximumValue="80"
      Value="50"
      Interval="10">
    </IgbRadialGauge>
    

    Optical Scaling

    The radial gauge's labels and titles can change it's scaling. To enable this, first set OpticalScalingEnabled to true. Then you can set OpticalScalingSize which manages the size at which labels have 100% optical scaling. Labels will have larger fonts when gauge's size is larger. For example, labels will have a 200% larger font size when this property is set to 500 and the gauge px size is doubled to eg. 1000.

    Tick Marks

    Tick marks are thin lines radiating from the center of the radial gauge. There are two types of tick marks: major and minor. Major tick marks are displayed at the Interval between the MinimumValue and MaximumValue properties. Use the MinorTickCount property to specify the number of minor tick marks displayed between each major tick mark. You can control the length of tick marks by setting a fraction (between 0 and 1) to TickStartExtent, TickEndExtent, MinorTickStartExtent, and MinorTickEndExtent properties.

     <IgbRadialGauge Height="100%" Width="100%"
        TickStartExtent="0.5"
        TickEndExtent="0.57"
        TickStrokeThickness="2"
        TickBrush="DodgerBlue"
        MinorTickCount="4"
        MinorTickEndExtent="0.520"
        MinorTickStartExtent="0.57"
        MinorTickStrokeThickness="1"
        MinorTickBrush="DarkViolet"
        MinimumValue="0"
        MaximumValue="80"
        Value="50"
        Interval="10">
    </IgbRadialGauge>
    

    Ranges

    A range highlights a set of continuous values bound by a specified MinimumValue and MaximumValue properties. You can add multiple ranges to the radial gauge by specifying their starting and ending values. Each range has a few customization properties such as Brush and Outline. Alternatively, you can set RangeBrushes and RangeOutlines properties to a list of colors for the ranges.

    <IgbRadialGauge Height="100%" Width="100%"
          MinimumValue="0" Value="50"
          MaximumValue="80" Interval="10"
          RangeBrushes="#A4BD29, #F86232"
          RangeOutlines="#A4BD29, #F86232">
        <IgbRadialGaugeRange StartValue="10"
              EndValue="25"
              InnerStartExtent="0.50"
              InnerEndExtent="0.50"
              OuterStartExtent="0.57"
              OuterEndExtent="0.57">
        </IgbRadialGaugeRange>
        <IgbRadialGaugeRange StartValue="25"
              EndValue="40"
              InnerStartExtent="0.50"
              InnerEndExtent="0.50"
              OuterStartExtent="0.57"
              OuterEndExtent="0.57">
        </IgbRadialGaugeRange>
    </IgbRadialGauge>
    

    Needle

    Radial gauge needles are visual elements used to signify a gauge set value. Needles are available in one of the several predefined shapes. The needle can have a pivot shape, which is placed in the center of the gauge. The pivot shape also takes one of the predefined shapes. Pivot shapes that include an overlay or an underlay can have a separate pivot brush applied to the shape.

    The supported needle shapes and caps are set using the NeedleShape and NeedlePivotShape properties.

    You can enable an interactive mode of the gauge (using IsNeedleDraggingEnabled property) and the end-user will be able to change value by dragging the needle between values of MinimumValue and MaximumValue properties.

    <IgbRadialGauge Height="100%" Width="100%"
        IsNeedleDraggingEnabled="true"
        IsNeedleDraggingConstrained="true"
        NeedleShape="RadialGaugeNeedleShape.NeedleWithBulb"
        NeedleBrush="DodgerBlue"
        NeedleOutline="DodgerBlue"
        NeedleEndExtent="0.475"
        NeedleStrokeThickness="1"
        NeedlePivotShape="RadialGaugePivotShape.CircleOverlay"
        NeedlePivotBrush="#9F9FA0"
        NeedlePivotOutline="#9F9FA0"
        NeedlePivotWidthRatio="0.2"
        NeedlePivotStrokeThickness="1"
        Value="50"
        MinimumValue="0"
        MaximumValue="80"
        Interval="10">
    </IgbRadialGauge>
    

    Summary

    For your convenience, all above code snippets are combined into one code block below that you can easily copy to your project and see the radial gauge with all features and visuals enabled.

    <IgbRadialGauge Height="100%" Width="100%"
                 MinimumValue="0"
                 MaximumValue="80"
                 Value="50"
                 Interval="10"
    
                 ScaleStartAngle="135"
                 ScaleEndAngle="45"
                 ScaleBrush="DodgerBlue"
                 ScaleSweepDirection="SweepDirection.Clockwise"
                 ScaleOversweep="1"
                 ScaleOversweepShape="RadialGaugeScaleOversweepShape.Fitted"
                 ScaleStartExtent="0.45"
                 ScaleEndExtent="0.575"
    
                 IsNeedleDraggingEnabled="true"
                 IsNeedleDraggingConstrained="true"
                 NeedleShape="RadialGaugeNeedleShape.NeedleWithBulb"
                 NeedleBrush="DodgerBlue"
                 NeedleOutline="DodgerBlue"
                 NeedleEndExtent="0.475"
                 NeedleStrokeThickness="1"
                 NeedlePivotShape="RadialGaugePivotShape.CircleOverlay"
                 NeedlePivotBrush="#9F9FA0"
                 NeedlePivotOutline="#9F9FA0"
                 NeedlePivotWidthRatio="0.2"
                 NeedlePivotStrokeThickness="1"
                 TickStartExtent="0.5"
                 TickEndExtent="0.57"
                 TickStrokeThickness="2"
                 TickBrush="DodgerBlue"
    
                 MinorTickCount="4"
                 MinorTickEndExtent="0.520"
                 MinorTickStartExtent="0.57"
                 MinorTickStrokeThickness="1"
                 MinorTickBrush="DarkViolet"
    
                 LabelExtent="0.65"
                 LabelInterval="10"
                 Font="11px Verdana"
                 FontBrush="Black"
                 BackingShape="RadialGaugeBackingShape.Fitted"
                 BackingBrush="#FCFCFC"
                 BackingOutline="DodgerBlue"
                 BackingOversweep="5"
                 BackingCornerRadius="10"
                 BackingStrokeThickness="5"
                 BackingOuterExtent="0.8"
                 BackingInnerExtent="0.15"
    
                 RangeBrushes="#A4BD29, #F86232"
                 RangeOutlines="#A4BD29, #F86232">
        <IgbRadialGaugeRange StartValue="20"
            EndValue="40"
            InnerStartExtent="0.50"
            InnerEndExtent="0.50"
            OuterStartExtent="0.57"
            OuterEndExtent="0.57">
        </IgbRadialGaugeRange>
        <IgbRadialGaugeRange StartValue="40"
            EndValue="60"
            InnerStartExtent="0.50"
            InnerEndExtent="0.50"
            OuterStartExtent="0.57"
            OuterEndExtent="0.57">
        </IgbRadialGaugeRange>
    </IgbRadialGauge>
    

    API References

    The following is a list of API members mentioned in the above sections:

    Additional Resources

    You can find more information about other types of gauges in these topics: