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.
Component Modules
The IgbLinearGauge
requires the following modules:
// in Program.cs file
builder.Services.AddIgniteUIBlazor(typeof(IgbLinearGaugeModule));
Usage
O código a seguir demonstra como criar um medidor linear contendo uma agulha e três faixas comparativas na escala.
<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
Esta é a medida principal exibida pelo componente de medidor linear e é visualizada como uma barra ou você pode personalizá-la para mostrar quase qualquer formato, conforme demonstrado abaixo.
<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>
Highlight Needle
The linear gauge can be modified to show a second needle. This will make the main needle's Value
appear with a lower opacity. To enable this first set HighlightValueDisplayMode
to Overlay and then apply a HighlightValue
.
<IgbLinearGauge Height="80px" Width="100%"
MinimumValue="0"
MaximumValue="100"
Value="75"
Interval="10"
LabelInterval="10"
LabelExtent="0.025"
LabelsPreTerminal="0"
LabelsPostInitial="0"
NeedleBrush="Blue"
HighlightValueDisplayMode="HighlightedValueDisplayMode.Overlay"
HighlightValue=25
IsHighlightNeedleDraggingEnabled=true>
</IgbLinearGauge>
Ranges
Os intervalos são elementos visuais que destacam um intervalo especificado de valores em uma escala. Seu propósito é comunicar visualmente o estado qualitativo da medida da barra de desempenho, ilustrando ao mesmo tempo o grau em que ela reside dentro desse estado.
<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
As marcas de verificação servem como uma divisão visual da escala em intervalos para aumentar a legibilidade do medidor linear.
Marcas de escala principais – As marcas de escala principais são usadas como delimitadores primários na escala. A frequência em que aparecem, suas extensões e estilo podem ser controlados definindo suas propriedades correspondentes.
Marcas de verificação menores – As marcas de verificação menores representam marcas de verificação auxiliares, que podem ser usadas para melhorar ainda mais a legibilidade da escala e podem ser personalizadas de forma semelhante às principais.
<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
As etiquetas indicam as medidas na escala.
<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
O elemento de apoio representa o fundo e a borda do componente de calibre linear. Ele é sempre o primeiro elemento renderizado e todos os outros elementos, como rótulos e marcas de escala, são sobrepostos a ele.
<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
Para sua conveniência, todos os trechos de código acima são combinados em um bloco de código abaixo que você pode copiar facilmente para seu projeto e ver o medidor linear com todos os recursos e visuais habilitados.
<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>
API References
A seguir está uma lista de membros da API mencionados nas seções acima:
Additional Resources
Você pode encontrar mais informações sobre outros tipos de medidores nestes tópicos: