Blazor Linear Gauge Overview

    The Ignite UI for Blazor linear gauge component allows for visualizing data in the form of a linear gauge. The IgbLinearGauge provides a simple and concise view of a value compared against a scale and one or more ranges. It supports one scale, one set of tick marks and one set of labels. The component has also a built-in support for animated transitions. This animation is easily customizable by setting the TransitionDuration property. The features of the linear gauge component include configurable orientation and direction, configurable visual elements such as the needle, and more.

    Blazor Linear Gauge Example

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

    Required Modules

    The IgbLinearGauge requires the following modules:

    IgbLinearGaugeModule.Register(IgniteUIBlazor);
    

    Usage

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

    <IgbLinearGauge Height="80px" Width="100%"
            MinimumValue="5"
            MaximumValue="55"
            Value="43" >
        <IgbLinearGraphRange StartValue="0"
                EndValue="15"
                Brush="red" >
        </IgbLinearGraphRange>
         <IgbLinearGraphRange StartValue="15"
                EndValue="30"
                Brush="yellow">
        <IgbLinearGraphRange StartValue="30"
                EndValue="55"
                Brush="green">
        </IgbLinearGraphRange>
    </IgbLinearGauge>
    

    Needle

    This is the primary measure displayed by the linear gauge component and is visualized as a bar or you can customize it to show almost any shape as is demonstrated below.

    <IgbLinearGauge Height="80px" Width="100%"
        MinimumValue="0" Value="50"
        MaximumValue="100" Interval="10"
        IsNeedleDraggingEnabled="true"
        NeedleShape="LinearGraphNeedleShape.Custom"
        NeedleBrush="DodgerBlue"
        NeedleOutline="DodgerBlue"
        NeedleStrokeThickness="1"
        NeedleBreadth="15"
        NeedleInnerExtent="0.35"
        NeedleOuterExtent="0.65"
        NeedleOuterPointExtent="0.8"
        NeedleInnerPointExtent="0.325"
        NeedleInnerPointWidth="0"
        NeedleOuterPointWidth="0.3"
        NeedleInnerBaseWidth="0"
        NeedleOuterBaseWidth="0.07">
    </IgbLinearGauge>
    

    Ranges

    The ranges are visual elements that highlight a specified range of values on a scale. Their purpose is to visually communicate the qualitative state of the performance bar measure, illustrating at the same times the degree to which it resides within that state.

    <IgbLinearGauge Height="80px" Width="100%"
            MinimumValue="0" Value="50"
            MaximumValue="100" Interval="10"
            RangeBrushes="#A4BD29, #F86232"
            RangeOutlines="#A4BD29, #F86232">
        <IgbLinearGraphRange StartValue="0"
                EndValue="50"
                InnerStartExtent="0.075"
                InnerEndExtent="0.075"
                OuterStartExtent="0.25"
                OuterEndExtent="0.4">
        </IgbLinearGraphRange>
        <IgbLinearGraphRange StartValue="50"
                EndValue="100"
                InnerStartExtent="0.075"
                InnerEndExtent="0.075"
                OuterStartExtent="0.4"
                OuterEndExtent="0.55">
        </IgbLinearGraphRange>
    </IgbLinearGauge>
    

    Tick Marks

    The tick marks serve as a visual division of the scale into intervals in order to increase the readability of the linear gauge.

    Major tick marks – The major tick marks are used as primary delimiters on the scale. The frequency they appear at, their extents and style can be controlled by setting their corresponding properties.

    Minor tick marks – The minor tick marks represent helper tick marks, which might be used to additionally improve the readability of the scale and can be customized in a way similar to the major ones.

     <IgbLinearGauge Height="80px" Width="100%"
        MinimumValue="0" Value="50"
        MaximumValue="100" Interval="10"
        TickBrush="DodgerBlue"
        TicksPreTerminal="0"
        TicksPostInitial="0"
        TickStrokeThickness="2"
        TickStartExtent="0.25"
        TickEndExtent="0.05"
        MinorTickCount="4"
        MinorTickBrush="DarkViolet"
        MinorTickEndExtent="0.05"
        MinorTickStartExtent="0.15"
        MinorTickStrokeThickness="1">
    </IgbLinearGauge>
    

    Labels

    The labels indicate the measures on the scale.

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

    Backing

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

    <IgbLinearGauge Height="80px" Width="100%"
        MinimumValue="0"
        MaximumValue="100"
        Value="50"
        Interval="10"
        BackingBrush="#BDDCFC"
        BackingOutline="DodgerBlue"
        BackingStrokeThickness="4"
        BackingInnerExtent="0"
        BackingOuterExtent="1">
    </IgbLinearGauge>
    

    Scale

    The scale is a visual element that highlights the full range of values in the linear gauge. You can customize the appearance and the shape of the scale. It can also be inverted (using IsScaleInverted property) and all labels will be rendered from right-to-left instead of left-to-right.

    <IgbLinearGauge Height="80px" Width="100%"
        MinimumValue="0" Value="50"
        MaximumValue="100" Interval="10"
        IsScaleInverted="false"
        ScaleBrush="DodgerBlue"
        ScaleOutline="Red"
        ScaleStrokeThickness="2"
        ScaleInnerExtent="0.05"
        ScaleOuterExtent="0.65"
        ScaleStartExtent="0.05"
        ScaleEndExtent="0.95">
    </IgbLinearGauge>
    

    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 linear gauge with all features and visuals enabled.

    <IgbLinearGauge Height="80px" Width="100%"
            MinimumValue="0"
            MaximumValue="100"
    
            LabelInterval="10"
            LabelExtent="0.025"
            LabelsPreTerminal="0"
            LabelsPostInitial="0"
            FontBrush="DodgerBlue"
            Font="11px Verdana"
    
            Interval="10"
            TickBrush="DodgerBlue"
            TicksPreTerminal="0"
            TicksPostInitial="0"
            TickStrokeThickness="2"
            TickStartExtent="0.25"
            TickEndExtent="0.05"
    
            MinorTickCount="4"
            MinorTickBrush="DarkViolet"
            MinorTickEndExtent="0.05"
            MinorTickStartExtent="0.15"
            MinorTickStrokeThickness="1"
            Value="50"
            MaximumValue="100" Interval="10"
            IsNeedleDraggingEnabled="true"
            NeedleShape="LinearGraphNeedleShape.Custom"
            NeedleBrush="DodgerBlue"
            NeedleOutline="DodgerBlue"
            NeedleStrokeThickness="1"
            NeedleBreadth="15"
            NeedleInnerExtent="0.35"
            NeedleOuterExtent="0.65"
            NeedleOuterPointExtent="0.8"
            NeedleInnerPointExtent="0.325"
            NeedleInnerPointWidth="0"
            NeedleOuterPointWidth="0.3"
            NeedleInnerBaseWidth="0"
            NeedleOuterBaseWidth="0.07"
    
            IsScaleInverted="false"
            ScaleBrush="DodgerBlue"
            ScaleOutline="Red"
            ScaleStrokeThickness="2"
            ScaleInnerExtent="0.05"
            ScaleOuterExtent="0.65"
            ScaleStartExtent="0.05"
            ScaleEndExtent="0.95"
    
            BackingBrush="#BDDCFC"
            BackingOutline="DodgerBlue"
            BackingStrokeThickness="4"
            BackingInnerExtent="0"
            BackingOuterExtent="1"
    
            RangeBrushes="#A4BD29, #F86232"
            RangeOutlines="#A4BD29, #F86232">
        <IgbLinearGraphRange StartValue="0"
                    EndValue="50"
                    InnerStartExtent="0.075"
                    InnerEndExtent="0.075"
                    OuterStartExtent="0.25"
                    OuterEndExtent="0.4">
        </IgbLinearGraphRange>
        <IgbLinearGraphRange StartValue="50"
                    EndValue="100"
                    InnerStartExtent="0.075"
                    InnerEndExtent="0.075"
                    OuterStartExtent="0.4"
                    OuterEndExtent="0.55">
        </IgbLinearGraphRange>
    </IgbLinearGauge>
    

    Additional Resources

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

    API Members

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