Class SfLinearGauge
The Linear Gauge is an ideal control for visualizing numeric values in a linear scale with features like multiple axes, different orientations, and more.
Inherited Members
Namespace: Syncfusion.Blazor.LinearGauge
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfLinearGauge : SfBaseComponent
Constructors
SfLinearGauge()
Initializes a new instance of the SfLinearGauge class.
Declaration
public SfLinearGauge()
Properties
AllowImageExport
Gets or sets a value indicating whether the export as image functionality is enabled in the linear gauge.
Declaration
public bool AllowImageExport { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enable this to allow users to export the gauge visualization as an image file.
AllowMargin
Gets or sets a value indicating whether the margin functionality is enabled in the linear gauge.
Declaration
public bool AllowMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When enabled, this allows for additional spacing around the gauge components.
AllowPdfExport
Gets or sets a value indicating whether the export as PDF functionality is enabled in the linear gauge.
Declaration
public bool AllowPdfExport { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enable this setting to allow users to export the gauge to a PDF document.
AllowPrint
Gets or sets a value indicating whether the print functionality is enabled in the linear gauge.
Declaration
public bool AllowPrint { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When enabled, this feature allows printing of the gauge directly from the browser.
AnimationDuration
Gets or sets the duration time for the loading animation in the linear gauge.
Declaration
public double AnimationDuration { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value specifying the animation duration in milliseconds. |
Remarks
Adjust this value to control the speed of the loading animation. Setting it to 0 disables animation.
Background
Gets or sets the background color of the gauge. This property accepts values in hex code, rgba string, or any valid CSS color string.
Declaration
public string Background { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string specifying the background color. |
Remarks
Use standard CSS color formats to specify the background color to match your design requirements.
ChildContent
Gets or sets the content of the UI element.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | A Microsoft.AspNetCore.Components.RenderFragment defining the content of the UI element. |
Remarks
Use this property to add child content to the linear gauge.
Description
Gets or sets the description for the linear gauge.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string describing the purpose or content of the gauge. |
Remarks
Useful for accessibility and providing contextual information about the gauge to assistive technologies.
EnableGroupingSeparator
Gets or sets a value indicating whether to split numeric values in the component with a comma.
Declaration
public bool EnableGroupingSeparator { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enable the grouping separator for enhanced readability of large numbers displayed on the gauge.
Format
Gets or sets the format to apply for internationalization in the linear gauge.
Declaration
public string Format { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the format pattern. |
Remarks
Use this property to format numeric or date-time values displayed in the gauge according to cultural standards.
Height
Gets or sets the height of the linear gauge. The value can include units like 'px' or '%'.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value denoting the height. |
Remarks
If specified as '100%', the gauge will fill the full height of its parent element.
ID
Gets or sets the ID string for the linear gauge component.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value that uniquely identifies the component. |
Remarks
Use this ID for referencing the component in scripts or style sheets.
Orientation
Gets or sets the orientation of the rendering of the linear gauge.
Declaration
public Orientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
Orientation | An Orientation value specifying the orientation of the linear gauge. The default is Vertical. |
Remarks
Determines whether the gauge is arranged vertically or horizontally within its container.
RangePalettes
Gets or sets the color palette for axis ranges in the linear gauge.
Declaration
public string[] RangePalettes { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | A string array specifying the color palette for ranges. |
Remarks
Customize the appearance and distinction of axis ranges by assigning different colors.
TabIndex
Gets or sets the tab index value for the linear gauge.
Declaration
public int TabIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An integer representing the tab index. The default value is |
Remarks
Controls the tab order of the component when navigating through the page using a keyboard.
Theme
Gets or sets the theme supported for the linear gauge.
Declaration
public Theme Theme { get; set; }
Property Value
Remarks
Choose from predefined themes to apply consistent styling across your application.
Title
Gets or sets the title for the linear gauge.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string containing the title. |
Remarks
The title provides a label or brief description at the top of the gauge.
Width
Gets or sets the width of the linear gauge as a string. Value can include units like 'px' or '%'.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value representing the width. |
Remarks
If specified as '100%', the gauge will fill the full width of its parent element.
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose(Boolean)
Disposes the property values during the destroy of the component that is hold up for the execution of the component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
EndAnimation()
This method is used to update the AllowAnimation property when animation is completed.
Declaration
public void EndAnimation()
ExportAsync(ExportType, String, Nullable<PdfPageOrientation>, Boolean)
The method is used to perform the export functionality for the rendered linear gauge.
Declaration
public Task<string> ExportAsync(ExportType type, string fileName, Nullable<PdfPageOrientation> orientation = null, bool allowDownload = true)
Parameters
Type | Name | Description |
---|---|---|
ExportType | type | Specifies the export type for the rendered linear gauge. |
System.String | fileName | Specifies the filename. |
System.Nullable<Syncfusion.PdfExport.PdfPageOrientation> | orientation | Specifies the portrait or landscape orientation of the page. |
System.Boolean | allowDownload | Specifies whether to download or not. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | Returns base64 string of the exported file. |
Remarks
Use this method to export the linear gauge to an image or PDF format for offline analysis or sharing.
OnAfterRenderAsync(Boolean)
OnAfterRenderAsync is a lifecycle method that is invoked each time the component is rendered in the application.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender | represents the method hitting counts. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
Overrides
OnGaugeInitialized()
OnGaugeInitialized method is called when the component has received its initial parameters.
Declaration
protected Task OnGaugeInitialized()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
OnGaugeParametersSet()
OnParametersSet is a lifecycle method that is invoked when the component has received parameters, and the incoming values have been assigned to the properties.
Declaration
protected Task OnGaugeParametersSet()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
OnInitializedAsync()
OnInitializedAsync method is called when the component has received its initial parameters.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
Overrides
OnParametersSetAsync()
OnParametersSetAsync is a lifecycle method that is invoked when the component has received parameters, and the incoming values have been assigned to the properties.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
PrintAsync()
The method is used to print the rendered linear gauge.
Declaration
public Task PrintAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method utilizes asynchronous operations to print the linear gauge, providing better performance.
RefreshAsync()
The method is used to render the linear gauge again.
Declaration
public Task RefreshAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Use this method to re-render and update the linear gauge in response to changes in data or configuration.
SetAnnotationValue(Int32, String, Int32)
The method is used to set the annotation value dynamically for linear gauge.
Declaration
public void SetAnnotationValue(int annotationIndex, string content, int axisValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | annotationIndex | Specifies the index number of the axis in which the annotation value is to be changed. |
System.String | content | Specifies the value of the annotation to be updated in it. |
System.Int32 | axisValue | Specifies the index number of the annotation in which the value is to be changed. |
Remarks
Use this method to dynamically update annotation content on the linear gauge during runtime.
SetPointerValue(Int32, Int32, Double)
The method is used to set the pointer value dynamically for linear gauge.
Declaration
public void SetPointerValue(int axisIndex, int pointerIndex, double pointerValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | axisIndex | Specifies the index number of the axis in which the pointer value is to be changed. |
System.Int32 | pointerIndex | Specifies the index number of the pointer in which the value is to be changed. |
System.Double | pointerValue | Specifies the value of the pointer to be updated in it. |
Remarks
Use this method to update the pointer value programmatically in response to user actions or other events.