
Syncfusion Blazor Linear Gauge
- 196 installs
- 4 repo stars
- Updated July 28, 2026
- syncfusion/blazor-ui-components-skills
Use syncfusion-blazor-linear-gauge for development tasks
About
syncfusion-blazor-linear-gauge: A skill for development. This provides functionality for development workflows.
- syncfusion-blazor-linear-gauge
Syncfusion Blazor Linear Gauge by the numbers
- 196 all-time installs (skills.sh)
- +13 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #2,033 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/blazor-ui-components-skills --skill syncfusion-blazor-linear-gaugeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 196 |
|---|---|
| repo stars | ★ 4 |
| Last updated | July 28, 2026 |
| Repository | syncfusion/blazor-ui-components-skills ↗ |
What it does
Use syncfusion-blazor-linear-gauge for development tasks
Files
Implementing Syncfusion Blazor Linear Gauges
NuGet: Syncfusion.Blazor.LinearGauge + Syncfusion.Blazor.Themes Namespace: Syncfusion.Blazor.LinearGauge
When to Use This Skill
Use this skill when the user needs to:
- Visualize numeric values on a linear scale (horizontal or vertical)
- Display measurement data like temperature, pressure, speed, or progress
- Create dashboard components with gauge visualizations
- Implement KPI displays with ranges and indicators
- Show real-time data with animated pointers
- Build interactive gauges where users can drag pointers to change values
- Create multi-scale visualizations with multiple axes and pointers
The Syncfusion Blazor Linear Gauge is ideal for applications requiring precise numeric visualization with customizable scales, pointers, and ranges.
---
Component Overview
The Blazor Linear Gauge (SfLinearGauge) is a data visualization component that displays numeric values on a linear scale with features including:
- Multiple axes with customizable ranges and styling
- Various pointer types (marker shapes, bar pointers, text, images)
- Color-coded ranges for value categorization
- Annotations for labels and custom content
- Interactive features including drag-to-change pointer values
- Events and methods for dynamic updates
- Accessibility support with WCAG compliance
- Internationalization for global applications
---
Documentation and Navigation Guide
This skill provides comprehensive, self-contained reference files for each aspect of the Linear Gauge component. Read the appropriate reference based on your current need.
Getting Started
📄 Read: references/getting-started.md
When to read: First-time setup, new project initialization, installation questions
What's covered:
- Installation via Visual Studio, VS Code, and .NET CLI
- NuGet package installation (Syncfusion.Blazor.LinearGauge, Syncfusion.Blazor.Themes)
- Namespace imports and service registration
- Stylesheet and script references
- Basic LinearGauge component implementation
- Adding pointers and setting values
- Adding titles and ranges
- Running your first gauge application
Core Components
Axes Configuration
📄 Read: references/axes-configuration.md
When to read: Setting up gauge scales, customizing axis appearance, working with multiple axes
What's covered:
- Setting Minimum and Maximum values for the scale
- Line customization (height, width, color, offset)
- Major ticks configuration (interval, height, color, width, position, offset)
- Minor ticks configuration (interval, height, color, width, position, offset)
- Label customization (format, font, position, offset)
- Multiple axes on single gauge
- Inverse axis direction
- Opposed position for axes
- Complete code examples for all configurations
Pointers
📄 Read: references/pointers.md
When to read: Adding value indicators, customizing pointer appearance, implementing multiple pointers
What's covered:
- Setting pointer values
- Marker pointers with various shapes (Circle, Rectangle, Triangle, Diamond, InvertedTriangle)
- Bar pointers with customization options
- Image pointers with custom images
- Text pointers with custom styling
- Pointer positioning and placement
- Animation configuration for smooth transitions
- Multiple pointers on single axis
- Drag and drop interaction for value changes
- Complete examples for each pointer type
Ranges
📄 Read: references/ranges.md
When to read: Adding color-coded value regions, implementing performance zones, creating visual thresholds
What's covered:
- Setting range start and end values
- Range color customization
- Range positioning (inside, outside, cross)
- Range offset configuration
- Start and end width for gradient effects
- Multiple ranges on single axis
- Practical use cases (temperature zones, performance indicators, status ranges)
- Complete code examples with visual results
Appearance and Styling
Annotations
📄 Read: references/annotations.md
When to read: Adding labels, custom content, units, or dynamic text to the gauge
What's covered:
- Adding text annotations
- HTML content in annotations
- Positioning annotations with x, y coordinates
- Z-index for layering multiple annotations
- Font styling for text annotations
- Horizontal and vertical alignment
- Multiple annotations on gauge
- Dynamic content updates
- Practical examples (unit labels, value displays, warnings)
Appearance and Styling
📄 Read: references/appearance-and-styling.md
When to read: Customizing gauge look and feel, theming, responsive design, print styling
What's covered:
- Container customization (width, height, background, border)
- Orientation (horizontal vs vertical)
- Margin and container adjustments
- Title customization (text, font, position)
- Theme selection (Bootstrap, Material, Fabric, Fluent, Tailwind, etc.)
- Custom CSS styling
- Responsive design considerations
- Color schemes and palettes
- Print-friendly styling
- Complete styling examples
Advanced Features
Methods and Events
📄 Read: references/methods-and-events.md
When to read: Implementing dynamic updates, handling user interactions, programmatic control
What's covered:
- setPointerValue() method for dynamic pointer updates
- setAnnotationValue() method for annotation updates
- print() method for printing gauges
- refresh() method for re-rendering
- Load and Loaded events
- AnimationComplete event
- AxisLabelRendering event for label customization
- AnnotationRendering event
- ValueChange event for user interactions
- TooltipRendering event
- ResizeCompleted event
- Complete event handler examples with practical scenarios
User Interaction
📄 Read: references/user-interaction.md
When to read: Enabling tooltips, drag interactions, mouse/touch events, value changes
What's covered:
- Tooltip configuration and customization
- Tooltip templates with custom HTML
- Pointer drag to change values
- Enabling/disabling pointer interaction
- Mouse and touch event handling
- Value change tracking and callbacks
- Animation on user interaction
- Complete interactive examples
Accessibility and Internationalization
📄 Read: references/accessibility-and-internationalization.md
When to read: Implementing WCAG compliance, keyboard navigation, screen readers, global applications
What's covered:
- Accessibility overview (WCAG 2.1 Level AA compliance)
- Keyboard navigation support
- Screen reader compatibility
- ARIA attributes and labels
- High contrast mode support
- Focus indicators
- Internationalization (i18n) setup
- Number formatting for different locales
- RTL (Right-to-Left) support
- Complete accessibility implementation examples
---
Quick Start Example
Here's a minimal example to get started with Blazor Linear Gauge:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Temperature Monitor">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="120">
<LinearGaugeAxisLabelStyle Format="{value}°C"></LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="65" Color="#007bff">
</LinearGaugePointer>
</LinearGaugePointers>
<LinearGaugeRanges>
<LinearGaugeRange Start="0" End="40" Color="#4CAF50"></LinearGaugeRange>
<LinearGaugeRange Start="40" End="80" Color="#FFC107"></LinearGaugeRange>
<LinearGaugeRange Start="80" End="120" Color="#F44336"></LinearGaugeRange>
</LinearGaugeRanges>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Result: A vertical linear gauge showing temperature from 0°C to 120°C with three color-coded ranges (green, yellow, red) and a pointer at 65°C.
---
Common Patterns
Pattern 1: Simple Progress Indicator
Use case: Show completion percentage or progress status
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Orientation="Syncfusion.Blazor.LinearGauge.Orientation.Horizontal" Width="400px" Height="80px">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="75" Type="Syncfusion.Blazor.LinearGauge.Point.Bar"
Color="#28a745" Width="20">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Pattern 2: Multi-Scale Dashboard Gauge
Use case: Display multiple metrics on one gauge
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="60" Color="#007bff"></LinearGaugePointer>
<LinearGaugePointer PointerValue="80" Color="#dc3545"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Pattern 3: Interactive Value Adjuster
Use case: Allow users to change values by dragging the pointer
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeEvents ValueChange="@OnValueChange"></LinearGaugeEvents>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@currentValue"
EnableDrag="true">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private double currentValue = 50;
private void OnValueChange(ValueChangeEventArgs args)
{
currentValue = args.Value;
}
}Pattern 4: Styled Thermometer
Use case: Temperature display with visual zones
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Width="150px" Height="400px">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="-20" Maximum="120">
<LinearGaugeAxisLabelStyle Format="{value}°">
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@temperature"
Type="Syncfusion.Blazor.LinearGauge.Point.Bar"
Color="#ff6b6b"
Width="20">
</LinearGaugePointer>
</LinearGaugePointers>
<LinearGaugeRanges>
<LinearGaugeRange Start="-20" End="0" Color="#0099ff"></LinearGaugeRange>
<LinearGaugeRange Start="0" End="25" Color="#00e676"></LinearGaugeRange>
<LinearGaugeRange Start="25" End="120" Color="#ff5252"></LinearGaugeRange>
</LinearGaugeRanges>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private double temperature = 35;
}---
API Reference
The official Linear Gauge API is centered on the SfLinearGauge component and comprehensive child components for configuring axes, pointers, ranges, annotations, gradients, tooltips, and event handlers. This reference is based on the official Syncfusion Blazor Linear Gauge API documentation.
SfLinearGauge
Primary container component for the gauge. This is the root component that hosts all gauge elements.
Component Properties:
Sizing & Layout:
Width(string): Sets the width of the linear gauge containerHeight(string): Sets the height of the linear gauge containerOrientation(Orientation): Sets the gauge orientation (HorizontalorVertical)Description(string): Sets the description for accessibility purposes
Appearance:
Title(string): Sets the title text displayed on the gaugeTitleStyle(LinearGaugeTitleStyle): Configures title font, position, and stylingBackground(string): Sets the background color of the gauge containerTheme(Theme): Applies predefined themes (Bootstrap, Material, Fabric, Fluent, Tailwind, etc.)Container(LinearGaugeContainer): Configures the container appearance and borderMargin(LinearGaugeMargin): Sets left, right, top, and bottom margins
Behavior:
AnimationDuration(double): Sets the animation duration (in milliseconds) for initial rendering and pointer updatesFormat(string): Sets the number format for axis labelsEnableGroupingSeparator(bool): Enables thousand separators in numbersID(string): Sets the unique identifier for the gauge componentTabIndex(int): Sets the tab order for keyboard navigation
Export & Print:
AllowPrint(bool): Enables print functionalityAllowPdfExport(bool): Enables PDF export functionalityAllowImageExport(bool): Enables image export (PNG, SVG) functionalityAllowMargin(bool): Includes margins when printing or exporting
Styling:
RangePalettes(string[]): Defines automatic color palette for ranges
Methods:
// Update pointer value programmatically (async version)
public async Task SetPointerValueAsync(int axisIndex, int pointerIndex, double value)
// Update annotation content dynamically (async version)
public async Task SetAnnotationValueAsync(int annotationIndex, string content)
// Refresh the entire gauge (async version)
public async Task RefreshAsync()
// Print the gauge (requires AllowPrint="true")
public async Task PrintAsync()
// Export gauge to file (requires corresponding AllowXyzExport="true")
public async Task ExportAsync(ExportType type, string fileName,
PdfPageOrientation? orientation = null, bool allowDownload = true)Export Types:
ExportType.PNGExportType.SVGExportType.PDF
LinearGaugeAxes & LinearGaugeAxis
Container (LinearGaugeAxes) for one or more axes. Each LinearGaugeAxis defines a scale with range, ticks, labels, pointers, and ranges.
LinearGaugeAxis Properties:
Scale Configuration:
Minimum(double): Sets the minimum value of the axis scaleMaximum(double): Sets the maximum value of the axis scaleIsInversed(bool): Reverses the direction of the axis (high to low instead of low to high)OpposedPosition(bool): Places the axis on the opposite side (left/right for vertical, top/bottom for horizontal)ShowLastLabel(bool): Shows or hides the last label on the axis
Child Components:
LinearGaugeLine- Configures the axis line appearanceLinearGaugeMajorTicks- Major tick marks on the axisLinearGaugeMinorTicks- Minor tick marks on the axisLinearGaugeAxisLabelStyle- Label styling and positioningLinearGaugeAxisLabelFont- Font properties for axis labelsLinearGaugeContainer- Container for the axisLinearGaugePointers- Pointer collection for this axisLinearGaugeRanges- Range collection for this axisLinearGaugeLinearGradient- Gradient fill for axis elementsLinearGaugeRadialGradient- Radial gradient for axis elements
Axis Line & Ticks
LinearGaugeLine - Defines the axis line appearance
Height(double): Height of the axis lineWidth(double): Width of the axis lineColor(string): Color of the axis lineOffset(double): Offset from axis
LinearGaugeMajorTicks - Major tick configuration
Interval(double): Interval between major ticksHeight(double): Height of major tick marksWidth(double): Width of major tick marksColor(string): Color of major ticksPosition(Position): Position relative to axis (Inside,Outside,Cross)Offset(double): Offset from axis line
LinearGaugeMinorTicks - Minor tick configuration
Interval(double): Interval between minor ticksHeight(double): Height of minor tick marksWidth(double): Width of minor tick marksColor(string): Color of minor ticksPosition(Position): Position relative to axisOffset(double): Offset from axis line
Axis Labels
LinearGaugeAxisLabelStyle - Label styling and positioning
Format(string): Format string for label values (e.g., "{value}°C")Position(Position): Label position (Inside,Outside,Cross)Offset(double): Distance from axis lineFontFamily(string): Font family for labelsColor(string): Color of label textOpacity(double): Opacity of labels (0 to 1)
LinearGaugeAxisLabelFont - Font properties for axis labels
FontFamily(string): Font family nameFontSize(string): Font size in pixels or relative unitsFontStyle(string): Font style (normal, italic, oblique)FontWeight(string): Font weight (normal, bold, lighter, bolder, 100-900)
LinearGaugePointers & LinearGaugePointer
Container (LinearGaugePointers) for one or more value indicators. Each LinearGaugePointer represents a value on the axis.
LinearGaugePointer Properties:
Value & Type:
PointerValue(double): Sets the pointer valueType(PointerType): Pointer type (MarkerorBar)MarkerType(MarkerType): Shape of marker pointer:CircleRectangleTriangleDiamondInvertedTriangle
Appearance:
Color(string): Pointer colorWidth(double): Width of pointerHeight(double): Height of pointerOpacity(double): Opacity of pointer (0 to 1)Offset(double): Offset from axis linePlacement(Placement): Placement relative to axis (Center,Near,Far)RoundedCornerRadius(double): Radius for rounded corners (bar pointers)
Content:
ImageUrl(string): URL for image pointerText(string): Text to display with text pointer
Interaction:
EnableDrag(bool): Allows user to drag the pointer to change valueAnimationDuration(double): Duration of value change animation (milliseconds)
Child Components:
LinearGaugePointerBorder- Border styling for pointerLinearGaugeMarkerTextStyle- Text styling for text pointers
Pointer Styling
LinearGaugePointerBorder - Pointer border properties
Color(string): Border colorWidth(double): Border width
LinearGaugeMarkerTextStyle - Text styling for pointer text
FontFamily(string): Font familyFontSize(string): Font sizeColor(string): Text colorFontWeight(string): Font weightOpacity(double): Text opacity
LinearGaugeRanges & LinearGaugeRange
Container (LinearGaugeRanges) for color-coded value zones. Each LinearGaugeRange defines a colored region.
LinearGaugeRange Properties:
Range Definition:
Start(double): Start value of the rangeEnd(double): End value of the range
Appearance:
Color(string): Background color of the rangeStartWidth(double): Width at start of range (for gradient width effect)EndWidth(double): Width at end of rangePosition(Position): Position relative to axis (Inside,Outside,Cross)Offset(double): Offset from axis line
Child Components:
LinearGaugeRangeBorder- Border styling for rangeLinearGaugeRangeTooltipSettings- Tooltip for range (hover)
LinearGaugeRangeBorder - Range border properties
Color(string): Border colorWidth(double): Border width
LinearGaugeAnnotations & LinearGaugeAnnotation
Container (LinearGaugeAnnotations) for text or HTML overlays. Each LinearGaugeAnnotation adds a label or custom content.
LinearGaugeAnnotation Properties:
Content & Positioning:
AxisValue(double): Position on the axis where annotation appearsAxisIndex(int): Index of the axis (if multiple axes)X(double): Horizontal pixel offset from axis valueY(double): Vertical pixel offset from axis valueZIndex(int): Layer order (higher appears on top)HorizontalAlignment(Alignment): Horizontal alignment (Near,Center,Far)VerticalAlignment(Alignment): Vertical alignment
Content:
Content(string): Text or HTML content for annotationContentTemplate(RenderFragment): Template for rendering annotation content
Child Components:
LinearGaugeAnnotationFont- Font styling for text annotations
LinearGaugeAnnotationFont - Font properties for annotations
FontFamily(string): Font familyFontSize(string): Font sizeColor(string): Text colorFontWeight(string): Font weightOpacity(double): Text opacity
Gradient Configuration
LinearGaugeLinearGradient - Linear gradient for gauge elements
StartValue(double): Start position of gradientEndValue(double): End position of gradientColorStops(ColorStops): Collection of color stops
LinearGaugeRadialGradient - Radial gradient for gauge elements
Radius(string): Radius of radial gradientInnerPosition(InnerPosition): Inner circle positionOuterPosition(OuterPosition): Outer circle positionColorStops(ColorStops): Collection of color stops
ColorStop / ColorStops - Gradient color definitions
Offset(string): Position in gradient (e.g., "0%", "100%")Color(string): Color at this positionOpacity(double): Opacity at this position
Container & Border Styling
LinearGaugeContainer - Outer container for the gauge
Type(ContainerType): Container type (Normal,RoundedRectangle,Thermometer)Offset(double): Offset from the axisWidth(double): Width of containerBackgroundColor(string): Background colorBorder(LinearGaugeContainerBorder): Border styling
LinearGaugeContainerBorder - Container border properties
Color(string): Border colorWidth(double): Border width
LinearGaugeBorder / LinearGaugeBorderSettings - Gauge border properties
Color(string): Border colorWidth(double): Border width
LinearGaugeMargin / LinearGaugeMarginSettings - Margin configuration
Left(double): Left marginRight(double): Right marginTop(double): Top marginBottom(double): Bottom margin
Tooltip Configuration
LinearGaugeTooltipSettings - Pointer tooltip configuration
Enable(bool): Enable or disable tooltipsFormat(string): Tooltip text formatPosition(TooltipPosition): Tooltip position (Top,Bottom,Left,Right)Fill(string): Tooltip background colorOpacity(double): Tooltip opacityShowAtMousePosition(bool): Show at cursor instead of pointerTextStyle(LinearGaugeTooltipTextStyle): Text stylingBorder(LinearGaugeTooltipBorder): Border styling
LinearGaugeRangeTooltipSettings - Range hover tooltip configuration
- Similar properties to tooltip settings for range hovers
LinearGaugeTooltipTextStyle - Tooltip text styling
FontFamily(string),FontSize(string),Color(string),FontWeight(string),Opacity(double)
Events & Event Arguments
LinearGaugeEvents - Event handler component
@using Syncfusion.Blazor.LinearGauge
<LinearGaugeEvents
Load="OnLoad"
Loaded="OnLoaded"
AxisLabelRendering="OnAxisLabelRendering"
AnnotationRendering="OnAnnotationRendering"
ValueChange="OnValueChange"
TooltipRendering="OnTooltipRendering"
DragStart="OnDragStart"
DragMove="OnDragMove"
DragEnd="OnDragEnd"
AnimationComplete="OnAnimationComplete"
ResizeCompleted="OnResizeCompleted"
OnGaugeMouseDown="OnMouseDown"
OnGaugeMouseLeave="OnMouseLeave"
OnGaugeMouseUp="OnMouseUp"
Print="OnPrint">
</LinearGaugeEvents>Event Types and Arguments:
| Event | Argument Type | Description |
|---|---|---|
Load | LoadEventArgs | Fires before gauge renders; can cancel with args.Cancel = true |
Loaded | LoadedEventArgs | Fires after gauge is successfully rendered |
AxisLabelRendering | AxisLabelRenderEventArgs | Fires before each axis label is rendered; modify args.Text to customize |
AnnotationRendering | AnnotationRenderEventArgs | Fires before annotation is rendered; modify args.Content to customize |
ValueChange | ValueChangeEventArgs | Fires when pointer value changes (user drag or programmatic); provides Value, PointerIndex, AxisIndex |
TooltipRendering | TooltipRenderEventArgs | Fires before tooltip displays; customize args.Content |
DragStart | PointerDragEventArgs | Fires when user starts dragging pointer; provides CurrentValue, PointerIndex, AxisIndex |
DragMove | PointerDragEventArgs | Fires continuously during pointer drag; provides current value |
DragEnd | PointerDragEventArgs | Fires when user releases pointer after drag |
AnimationComplete | AnimationCompleteEventArgs | Fires when pointer animation completes |
ResizeCompleted | ResizeEventArgs | Fires after gauge is resized; provides CurrentSize, PreviousSize |
OnGaugeMouseDown | MouseEventArgs | Fires on mouse down on gauge |
OnGaugeMouseLeave | MouseEventArgs | Fires when mouse leaves gauge |
OnGaugeMouseUp | MouseEventArgs | Fires on mouse up on gauge |
Print | PrintEventArgs | Fires before printing |
Enums
Orientation - Gauge layout direction
Orientation.Horizontal // Horizontal scale
Orientation.Vertical // Vertical scalePosition - Element positioning relative to axis
Position.Inside // Inside the axis
Position.Outside // Outside the axis
Position.Cross // Crossing the axis linePointerType - Type of value indicator
PointerType.Marker // Shaped marker (circle, square, etc.)
PointerType.Bar // Bar/rectangle pointerMarkerType - Shape of marker pointer
MarkerType.Circle
MarkerType.Rectangle
MarkerType.Triangle
MarkerType.Diamond
MarkerType.InvertedTrianglePlacement - Pointer position relative to axis
Placement.Center // Centered on axis
Placement.Near // Near side
Placement.Far // Far sideContainerType - Container shape
ContainerType.Normal // Rectangular container
ContainerType.RoundedRectangle // Rounded rectangle
ContainerType.Thermometer // Thermometer shapeExportType - Export format
ExportType.PNG // Export as PNG image
ExportType.SVG // Export as SVG image
ExportType.PDF // Export as PDF documentTooltipPosition - Tooltip placement
TooltipPosition.Top // Above the pointer
TooltipPosition.Bottom // Below the pointer
TooltipPosition.Left // Left of pointer
TooltipPosition.Right // Right of pointerTheme - Predefined color themes
Theme.Bootstrap
Theme.Material
Theme.Fabric
Theme.Fluent
Theme.Tailwind
Theme.Bootstrap5
Theme.FluentDark
Theme.MaterialDark
Theme.BootstrapDark
Theme.TailwindDark
// ... and othersPrimary Component Hierarchy
SfLinearGauge (root)
├── LinearGaugeTitleStyle
├── LinearGaugeMargin
├── LinearGaugeBorder
├── LinearGaugeContainer
│ └── LinearGaugeContainerBorder
├── LinearGaugeAxes
│ └── LinearGaugeAxis (repeatable)
│ ├── LinearGaugeLine
│ ├── LinearGaugeMajorTicks
│ ├── LinearGaugeMinorTicks
│ ├── LinearGaugeAxisLabelStyle
│ ├── LinearGaugeAxisLabelFont
│ ├── LinearGaugeContainer
│ ├── LinearGaugeLinearGradient
│ ├── LinearGaugeRadialGradient
│ ├── LinearGaugePointers
│ │ └── LinearGaugePointer (repeatable)
│ │ ├── LinearGaugePointerBorder
│ │ └── LinearGaugeMarkerTextStyle
│ └── LinearGaugeRanges
│ └── LinearGaugeRange (repeatable)
│ ├── LinearGaugeRangeBorder
│ └── LinearGaugeRangeTooltipSettings
├── LinearGaugeAnnotations
│ └── LinearGaugeAnnotation (repeatable)
│ └── LinearGaugeAnnotationFont
├── LinearGaugeTooltipSettings
│ ├── LinearGaugeTooltipTextStyle
│ └── LinearGaugeTooltipBorder
└── LinearGaugeEvents
├── Load handler
├── Loaded handler
├── AxisLabelRendering handler
├── AnnotationRendering handler
├── ValueChange handler
├── TooltipRendering handler
├── DragStart/Move/End handlers
├── AnimationComplete handler
└── ... more event handlersPractical API Usage Notes
1. Async Methods: All component methods (SetPointerValueAsync, SetAnnotationValueAsync, RefreshAsync, PrintAsync, ExportAsync) are asynchronous and must be awaited.
2. Export Prerequisites: Ensure AllowPdfExport="true", AllowImageExport="true", or AllowPrint="true" on the gauge before calling corresponding export or print methods.
3. Animation: Set AnimationDuration="0" for instant updates, or higher values for smooth animated transitions.
4. Event Arguments: Event handler arguments are provided by the framework and contain context-specific information (e.g., ValueChangeEventArgs contains the new value).
5. Index-Based Access: When using SetPointerValueAsync or SetAnnotationValueAsync, use zero-based indices for axes, pointers, and annotations.
6. Performance: For frequent updates (e.g., every 100ms), consider batching updates or using AnimationDuration="0" to avoid animation overhead.
7. Accessibility: Use Description, Title, and proper ARIA labels when the gauge needs to be accessible to screen readers.
Complete Component List
Component Classes (from Syncfusion.Blazor.LinearGauge namespace):
1. SfLinearGauge - Main component 2. LinearGaugeAnnotation - Annotation element 3. LinearGaugeAnnotationFont - Annotation font styling 4. LinearGaugeAnnotations - Annotation collection 5. LinearGaugeAxes - Axis collection 6. LinearGaugeAxis - Axis configuration 7. LinearGaugeAxisLabelFont - Axis label font 8. LinearGaugeAxisLabelStyle - Axis label styling 9. LinearGaugeBorder - Gauge border 10. LinearGaugeBorderSettings - Border settings 11. LinearGaugeContainer - Container configuration 12. LinearGaugeContainerBorder - Container border 13. LinearGaugeEvents - Event handlers 14. LinearGaugeFontSettings - Font configuration 15. LinearGaugeLine - Axis line 16. LinearGaugeLinearGradient - Linear gradient 17. LinearGaugeMajorTicks - Major tick marks 18. LinearGaugeMargin - Margin settings 19. LinearGaugeMarginSettings - Margin configuration 20. LinearGaugeMarkerTextStyle - Marker text styling 21. LinearGaugeMinorTicks - Minor tick marks 22. LinearGaugePointer - Pointer element 23. LinearGaugePointerBorder - Pointer border 24. LinearGaugePointers - Pointer collection 25. LinearGaugeRadialGradient - Radial gradient 26. LinearGaugeRange - Range element 27. LinearGaugeRangeBorder - Range border 28. LinearGaugeRangeTooltipBorder - Range tooltip border 29. LinearGaugeRangeTooltipSettings - Range tooltip 30. LinearGaugeRangeTooltipTextStyle - Range tooltip text 31. LinearGaugeRanges - Range collection 32. LinearGaugeTickSettings - Tick configuration 33. LinearGaugeTitleStyle - Title styling 34. LinearGaugeTooltipBorder - Tooltip border 35. LinearGaugeTooltipSettings - Tooltip configuration 36. LinearGaugeTooltipTextStyle - Tooltip text styling 37. LinearGradient - Linear gradient definition 38. RadialGradient - Radial gradient definition 39. ColorStop - Gradient color stop 40. ColorStops - Gradient color stops collection 41. Point - Pointer type enum 42. GradientPosition - Gradient position 43. InnerPosition - Inner gradient position 44. OuterPosition - Outer gradient position
Event Argument Classes:
LoadEventArgsLoadedEventArgsAxisLabelRenderEventArgsAnnotationRenderEventArgsValueChangeEventArgsTooltipRenderEventArgsPointerDragEventArgsResizeEventArgsMouseEventArgsPrintEventArgsAnimationCompleteEventArgs
Enum Types:
Orientation- Horizontal or VerticalPosition- Inside, Outside, CrossPointerType- Marker or BarMarkerType- Circle, Rectangle, Triangle, Diamond, InvertedTrianglePlacement- Center, Near, FarContainerType- Normal, RoundedRectangle, ThermometerExportType- PNG, SVG, PDFTooltipPosition- Top, Bottom, Left, RightTheme- Various theme optionsAlignment- Near, Center, FarPdfPageOrientation- Portrait, Landscape
---
Common Use Cases
1. Dashboard KPI Display
Display key performance indicators with color-coded ranges for quick status assessment. Use multiple gauges for different metrics.
2. Temperature Monitoring
Visualize temperature readings with appropriate ranges for different zones (freezing, normal, warning, critical).
3. Progress Tracking
Show task completion, project progress, or goal achievement using bar pointers on horizontal gauges.
4. Speedometer/Tachometer
Create vehicle dashboard components with styled pointers and ranges for speed or RPM display.
5. Sensor Data Visualization
Display real-time sensor readings (pressure, humidity, voltage) with dynamic pointer updates and threshold indicators.
6. Survey/Rating Display
Visualize survey results or ratings on a scale with markers showing average values and ranges for distribution.
7. Budget vs. Actual
Show financial metrics comparing budgeted vs. actual values using multiple pointers on the same axis.
8. Stock/Inventory Levels
Display inventory levels with color-coded ranges (critical, low, adequate, full) for quick status checks.
---
Tips for Implementation
When Starting
1. Begin with getting-started.md for setup 2. Add basic axis and pointer to verify functionality 3. Gradually add ranges, styling, and interactivity
For Customization
1. Use axes-configuration.md for scale customization 2. Use pointers.md for pointer styling 3. Use appearance-and-styling.md for overall look
For Interactivity
1. Enable pointer dragging for user input 2. Add tooltips for value display 3. Use events for responding to user actions 4. See user-interaction.md and methods-and-events.md
For Production
1. Implement accessibility features from accessibility-and-internationalization.md 2. Test with keyboard navigation 3. Verify screen reader compatibility 4. Configure proper ARIA labels
---
Next Steps
1. New to Linear Gauge? Start with getting-started.md 2. Need specific feature? Navigate to the relevant reference file based on your requirement 3. Building dashboard? Combine multiple patterns and refer to appearance-and-styling.md 4. Need interactivity? Check user-interaction.md and methods-and-events.md
All reference files are comprehensive and self-contained - you won't need to jump between multiple files for a single topic.
Accessibility and Internationalization in Blazor Linear Gauge
Table of Contents
- Overview
- Accessibility Features
- WCAG Compliance
- Screen Reader Support
- ARIA Attributes
- High Contrast Mode
- Internationalization
- Number Formatting
- Locale-Based Formatting
- Custom Format Strings
- Best Practices
- Complete Examples
Overview
The Blazor Linear Gauge provides comprehensive accessibility and internationalization features:
Accessibility:
- WCAG 2.1 compliance
- Screen reader compatibility
- ARIA attributes
- High contrast mode support
Internationalization:
- Number formatting for different locales
- Custom format strings
- Culture-specific rendering
These features ensure your gauges are usable by everyone, regardless of ability or language.
Accessibility Features
WCAG Compliance
The Linear Gauge follows Web Content Accessibility Guidelines (WCAG) 2.1 standards.
Built-in compliance features:
- Perceivable: Visual elements have sufficient contrast
- Operable: Fully keyboard accessible
- Understandable: Clear labels and structure
- Robust: Compatible with assistive technologies
Example of accessible gauge:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Temperature Monitor" Width="250px" Height="400px">
<LinearGaugeTitleStyle Color="#212529" Size="18px" FontWeight="bold">
</LinearGaugeTitleStyle>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="50">
<LinearGaugeAxisLabelStyle Format="{value}°C">
<LinearGaugeAxisLabelFont Color="#212529" Size="12px">
</LinearGaugeAxisLabelFont>
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="22"
Color="#007bff"
EnableDrag="true">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Accessibility features:
- Clear title describes gauge purpose
- High-contrast colors (text: #212529, pointer: #007bff)
- Sufficient text size (18px title, 12px labels)
- Unit labels provide context (°C)
Screen Reader Support
Linear Gauge provides semantic information to screen readers.
Screen reader features:
- Gauge announces its purpose via title
- Pointer values are announced when changed
- Tooltips are readable by screen readers
- Status changes are communicated
Example with screen reader optimization:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Battery Level">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugeAxisLabelStyle Format="{value}%">
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@batteryLevel"
Type="Syncfusion.Blazor.LinearGauge.Point.Bar"
Width="30"
Color="@batteryColor">
</LinearGaugePointer>
</LinearGaugePointers>
<LinearGaugeRanges>
<LinearGaugeRange Start="0" End="20"
Color="#dc3545">
</LinearGaugeRange>
<LinearGaugeRange Start="20" End="50"
Color="#ffc107">
</LinearGaugeRange>
<LinearGaugeRange Start="50" End="100"
Color="#28a745">
</LinearGaugeRange>
</LinearGaugeRanges>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<div role="status" aria-live="polite">
Battery level: @batteryLevel%. Status: @batteryStatus
</div>
@code {
private double batteryLevel = 75;
private string batteryColor = "#28a745";
private string batteryStatus = "Good";
protected override void OnInitialized()
{
UpdateBatteryStatus();
}
private void UpdateBatteryStatus()
{
if (batteryLevel < 20)
{
batteryStatus = "Critical - Charge soon";
batteryColor = "#dc3545";
}
else if (batteryLevel < 50)
{
batteryStatus = "Low";
batteryColor = "#ffc107";
}
else
{
batteryStatus = "Good";
batteryColor = "#28a745";
}
}
}Screen reader announces:
- "Battery Level Indicator"
- "Battery level: 75%. Status: Good"
- Range context when navigating
ARIA Attributes
Use ARIA (Accessible Rich Internet Applications) attributes to enhance accessibility.
Supported ARIA attributes:
@using Syncfusion.Blazor.LinearGauge
<div role="group" aria-labelledby="gauge-title">
<h3 id="gauge-title">System Performance</h3>
<SfLinearGauge>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugeAxisLabelStyle Format="{value}%">
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@cpuUsage"
EnableDrag="true">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
</div>
@code {
private double cpuUsage = 68;
}ARIA attributes used:
role="group"- Groups related elementsaria-labelledby- Associates label with gaugearia-label- Provides accessible namearia-valuemin- Minimum valuearia-valuemax- Maximum valuearia-valuenow- Current valuearia-valuetext- Human-readable value description
High Contrast Mode
Design gauges that work well in high contrast mode for users with visual impairments.
High contrast principles:
- Use distinct colors with high contrast ratios
- Avoid relying solely on color to convey information
- Provide text labels alongside visual indicators
- Ensure borders are visible
Example:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Temperature" Width="250px" Height="400px">
<LinearGaugeTitleStyle Color="#000000"
Size="18px"
FontWeight="bold">
</LinearGaugeTitleStyle>
<LinearGaugeBorder Color="#000000" Width="2">
</LinearGaugeBorder>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="50">
<LinearGaugeLine Color="#000000" Width="2">
</LinearGaugeLine>
<LinearGaugeAxisLabelStyle Format="{value}°C">
<LinearGaugeAxisLabelFont Color="#000000"
Size="12px"
FontWeight="600">
</LinearGaugeAxisLabelFont>
</LinearGaugeAxisLabelStyle>
<LinearGaugeMajorTicks Height="10"
Width="2"
Color="#000000">
</LinearGaugeMajorTicks>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="22"
Color="#0000FF"
Width="20"
Height="20">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>High contrast features:
- Black text and borders
- Bold fonts for better visibility
- Larger pointer size
- Strong color contrast (black on white, blue pointer)
- Thicker lines and borders
Internationalization
Number Formatting
Format numbers according to different locales and cultures.
Basic number formatting:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Format="n2">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100000">
<LinearGaugeAxisLabelStyle>
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="45000">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Format specifiers:
N2- Number with 2 decimal places (45000.00)C- Currency format ($45,000.00)P- Percentage format (45%){value}- Raw value
Locale-Based Formatting
Apply culture-specific formatting using .NET globalization.
Set culture in Program.cs:
using System.Globalization;
var builder = WebApplication.CreateBuilder(args);
// Set default culture
var culture = new CultureInfo("fr-FR");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSyncfusionBlazor();
var app = builder.Build();
// ... rest of configurationFrench locale example:
@using Syncfusion.Blazor.LinearGauge
@using System.Globalization
<div>
<p>Locale: @CultureInfo.CurrentCulture.Name</p>
</div>
<SfLinearGauge Title="Température">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="50">
<LinearGaugeAxisLabelStyle Format="{value}°C">
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="22.5">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Result: Numbers display with French formatting (22,5 instead of 22.5).
Custom Format Strings
Create custom formats for specific requirements.
Currency with Custom Symbol
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Revenue">
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="10000">
<LinearGaugeAxisLabelStyle Format="€{value}">
</LinearGaugeAxisLabelStyle>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="7500">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Result: Labels show "€0", "€2500", "€5000", etc.
Time Format
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Time Elapsed">
<LinearGaugeEvents AxisLabelRendering="OnAxisLabelRendering">
</LinearGaugeEvents>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="120">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="45">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private void OnAxisLabelRendering(Syncfusion.Blazor.LinearGauge.AxisLabelRenderEventArgs args)
{
int minutes = (int)args.AxisValue;
int hours = minutes / 60;
int mins = minutes % 60;
args.Text = $"{hours:D2}:{mins:D2}";
}
}Result: Labels show "00:00", "00:30", "01:00", "01:30", "02:00".
Metric Units
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Distance">
<LinearGaugeEvents AxisLabelRendering="OnAxisLabelRendering">
</LinearGaugeEvents>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="10000">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="2500">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private void OnAxisLabelRendering(Syncfusion.Blazor.LinearGauge.AxisLabelRenderEventArgs args)
{
double meters = args.AxisValue;
if (meters >= 1000)
{
args.Text = $"{meters / 1000:F1} km";
}
else
{
args.Text = $"{meters:F0} m";
}
}
}Result: Labels show "0 m", "2.5 km", "5.0 km", "7.5 km", "10.0 km".
Abbreviated Numbers
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Title="Population">
<LinearGaugeEvents AxisLabelRendering="OnAxisLabelRendering">
</LinearGaugeEvents>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="1000000">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="350000">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private void OnAxisLabelRendering(Syncfusion.Blazor.LinearGauge.AxisLabelRenderEventArgs args)
{
double value = args.AxisValue;
if (value >= 1000000)
{
args.Text = $"{value / 1000000:F1}M";
}
else if (value >= 1000)
{
args.Text = $"{value / 1000:F0}K";
}
else
{
args.Text = $"{value:F0}";
}
}
}Result: Labels show "0", "250K", "500K", "750K", "1.0M".
Best Practices
Accessibility Best Practices
1. Always provide a title - Describes the gauge's purpose 2. Use ARIA attributes - Enhance screen reader support 3. High contrast colors - Ensure visibility for all users 4. Text alternatives - Provide text values alongside visual indicators 5. Sufficient size - Make interactive elements large enough (minimum 44×44px for touch) 6. Focus indicators - Ensure focused elements are clearly visible 7. Avoid color-only communication - Use patterns, labels, or text
Internationalization Best Practices
1. Set culture early - Configure in Program.cs or App.razor 2. Use format specifiers - Leverage .NET formatting (N0, C, P) 3. Test with multiple locales - Verify appearance in target cultures 4. Localize all text - Titles, tooltips, annotations 5. Consider number systems - Some cultures use different digit symbols 6. Date/time awareness - Format time-based values appropriately 7. Unit localization - Use appropriate units (Celsius vs Fahrenheit, km vs miles)
Complete Examples
Fully Accessible Dashboard Gauge
@using Syncfusion.Blazor.LinearGauge
<div class="accessible-gauge" role="region" aria-labelledby="gauge-title">
<h3 id="gauge-title">Server CPU Usage</h3>
<p id="gauge-description">
Monitor real-time CPU usage. Use arrow keys to simulate CPU load.
</p>
<SfLinearGauge>
<LinearGaugeEvents ValueChange="OnValueChange">
</LinearGaugeEvents>
<LinearGaugeTooltipSettings Enable="true"
Format="{value}% CPU">
<LinearGaugeTooltipTextStyle Size="14px" FontWeight="bold">
</LinearGaugeTooltipTextStyle>
</LinearGaugeTooltipSettings>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugeAxisLabelStyle Format="{value}%">
<LinearGaugeAxisLabelFont Color="#212529"
Size="12px"
FontWeight="600">
</LinearGaugeAxisLabelFont>
</LinearGaugeAxisLabelStyle>
<LinearGaugeMajorTicks Height="10" Color="#495057">
</LinearGaugeMajorTicks>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@cpuUsage"
EnableDrag="true"
Color="@pointerColor"
Width="15"
Height="15">
</LinearGaugePointer>
</LinearGaugePointers>
<LinearGaugeRanges>
<LinearGaugeRange Start="0" End="50"
Color="#28a745">
</LinearGaugeRange>
<LinearGaugeRange Start="50" End="75"
Color="#ffc107">
</LinearGaugeRange>
<LinearGaugeRange Start="75" End="100"
Color="#dc3545">
</LinearGaugeRange>
</LinearGaugeRanges>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<div role="status" aria-live="polite" aria-atomic="true" class="status-message">
CPU Usage: @cpuUsage%. Status: @GetStatus()
</div>
<div class="legend" role="list">
<div role="listitem">
<span class="legend-color" style="background: #28a745;"></span>
<span>Normal (0-50%)</span>
</div>
<div role="listitem">
<span class="legend-color" style="background: #ffc107;"></span>
<span>Warning (50-75%)</span>
</div>
<div role="listitem">
<span class="legend-color" style="background: #dc3545;"></span>
<span>Critical (75-100%)</span>
</div>
</div>
</div>
<style>
.accessible-gauge {
max-width: 400px;
padding: 20px;
background: white;
border: 2px solid #dee2e6;
border-radius: 8px;
}
.accessible-gauge h3 {
margin-top: 0;
color: #212529;
}
.status-message {
margin-top: 15px;
padding: 10px;
background: #e9ecef;
border-radius: 4px;
font-weight: 600;
}
.legend {
margin-top: 15px;
display: flex;
flex-direction: column;
gap: 8px;
}
.legend > div {
display: flex;
align-items: center;
gap: 10px;
}
.legend-color {
width: 20px;
height: 20px;
border-radius: 3px;
border: 1px solid #dee2e6;
}
</style>
@code {
private double cpuUsage = 42;
private string pointerColor = "#28a745";
private void OnValueChange(ValueChangeEventArgs args)
{
cpuUsage = Math.Round(args.Value, 0);
UpdatePointerColor();
}
private void UpdatePointerColor()
{
if (cpuUsage < 50)
pointerColor = "#28a745";
else if (cpuUsage < 75)
pointerColor = "#ffc107";
else
pointerColor = "#dc3545";
}
private string GetStatus()
{
if (cpuUsage < 50) return "Normal";
if (cpuUsage < 75) return "Warning";
return "Critical";
}
}Multi-Locale Temperature Gauge
@using Syncfusion.Blazor.LinearGauge
@using System.Globalization
<div class="locale-selector">
<label for="locale-select">Select Locale:</label>
<select id="locale-select" @onchange="ChangeLocale">
<option value="en-US">English (US)</option>
<option value="fr-FR">Français (France)</option>
<option value="de-DE">Deutsch (Deutschland)</option>
<option value="ja-JP">日本語 (Japan)</option>
<option value="ar-SA">العربية (Saudi Arabia)</option>
</select>
</div>
<div>
<SfLinearGauge Title="@GetLocalizedTitle()"
Width="250px"
Height="400px">
<LinearGaugeTitleStyle FontWeight="bold" Size="18px">
</LinearGaugeTitleStyle>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="50">
<LinearGaugeAxisLabelStyle Format="@labelFormat">
</LinearGaugeAxisLabelStyle>
<LinearGaugeMajorTicks Interval="10"></LinearGaugeMajorTicks>
<LinearGaugeMinorTicks Interval="5"></LinearGaugeMinorTicks>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@temperature">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<div class="temperature-display">
@GetFormattedTemperature()
</div>
</div>
<style>
.locale-selector {
margin-bottom: 20px;
}
.locale-selector label {
margin-right: 10px;
font-weight: 600;
}
.locale-selector select {
padding: 5px 10px;
border: 1px solid #ced4da;
border-radius: 4px;
}
.temperature-display {
margin-top: 15px;
text-align: center;
font-size: 20px;
font-weight: bold;
color: #007bff;
}
</style>
@code {
private double temperature = 22.5;
private string currentLocale = "en-US";
private string labelFormat = "{value}°C";
private void ChangeLocale(Microsoft.AspNetCore.Components.ChangeEventArgs e)
{
currentLocale = e.Value.ToString();
var culture = new CultureInfo(currentLocale);
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
StateHasChanged();
}
private string GetLocalizedTitle()
{
return currentLocale switch
{
"en-US" => "Temperature",
"fr-FR" => "Température",
"de-DE" => "Temperatur",
"ja-JP" => "温度",
"ar-SA" => "درجة الحرارة",
_ => "Temperature"
};
}
private string GetFormattedTemperature()
{
var formatted = temperature.ToString("N1", CultureInfo.CurrentCulture);
return currentLocale switch
{
"en-US" => $"Current: {formatted}°C",
"fr-FR" => $"Actuel: {formatted}°C",
"de-DE" => $"Aktuell: {formatted}°C",
"ja-JP" => $"現在: {formatted}°C",
"ar-SA" => $"الحالي: {formatted}°م",
_ => $"Current: {formatted}°C"
};
}
}Key Takeaways
Accessibility: 1. WCAG Compliance - Follow Web Content Accessibility Guidelines 2. Screen Readers - Use semantic HTML and ARIA attributes 3. High Contrast - Use distinct colors with sufficient contrast 4. Focus Indicators - Make focused elements clearly visible 5. Text Alternatives - Provide context beyond color
Internationalization: 6. Set Culture - Configure globalization in Program.cs 7. Format Specifiers - Use N0, N2, C, P for locale-aware formatting 8. Custom Formats - Create formats with AxisLabelRendering event 9. Localize Text - Translate titles, tooltips, and labels 10. Test Locales - Verify appearance in target cultures
Making gauges accessible and internationalized ensures they work for all users, regardless of ability or language, expanding your application's reach and usability.
Annotations in Blazor Linear Gauge
Table of Contents
- Overview
- Adding Basic Annotations
- Annotation Content Types
- Text Annotations
- HTML Content Annotations
- Template Annotations
- Annotation Positioning
- Using X and Y Coordinates
- Using AxisValue
- Alignment Options
- Customization
- Multiple Annotations
- Practical Examples
Overview
Annotations allow you to overlay custom content (text, HTML elements, or images) on specific areas of the Linear Gauge. They're useful for:
- Adding labels or descriptions to specific gauge regions
- Displaying units or measurement information
- Showing dynamic values alongside the gauge
- Creating custom indicators or warnings
- Enhancing visual context with images or icons
Any number of annotations can be added to a Linear Gauge component.
Adding Basic Annotations
Create annotations using the LinearGaugeAnnotation component within LinearGaugeAnnotations.
Simple Text Annotation
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation AxisValue="50" ZIndex="1" Content="50">
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="50"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Result: The text "50" appears at axis value 50.
Annotation Content Types
Text Annotations
Simple text content displayed at a specific position.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation AxisValue="0" ZIndex="1" Content="40">
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="40"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>HTML Content Annotations
Add styled HTML elements using ContentTemplate.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation AxisValue="0" ZIndex="1">
<ContentTemplate>
<div class="custom-annotation">40</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="40"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style type="text/css">
.custom-annotation {
color: white;
background-color: blue;
height: 30px;
width: 30px;
border-radius: 15px;
padding: 4px 0 0 6px;
font-weight: bold;
}
</style>Result: A blue circular badge with white text showing "40".
Template Annotations
Create complex annotations with dynamic content, images, and formatting.
Unit Label Annotation
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1" AxisValue="100" X="-80" Y="-30">
<ContentTemplate>
<div style="background: #f0f0f0; padding: 5px 10px; border-radius: 4px;">
<strong>Temperature (°C)</strong>
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="65"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Image Annotation
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1" AxisValue="50" X="-40" Y="0">
<ContentTemplate>
<img src="warning-icon.png" width="30" height="30" alt="Warning" />
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="50"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Use case: Warning icons, status indicators, branding elements.
Annotation Positioning
Annotations can be positioned using multiple methods for precise placement.
Using X and Y Coordinates
Position annotations using pixel coordinates relative to the gauge container.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation AxisValue="0" ZIndex="1" X="50" Y="-100">
<ContentTemplate>
<div class="custom-annotation">40</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="40"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style>
.custom-annotation {
color: white;
background-color: blue;
height: 30px;
width: 30px;
border-radius: 15px;
padding: 4px 0 0 6px;
font-weight: bold;
}
</style>Properties:
- X: Horizontal position in pixels (positive = right, negative = left)
- Y: Vertical position in pixels (positive = down, negative = up)
Using AxisValue
Position annotations at specific axis values for value-aligned placement.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation AxisValue="75" ZIndex="1">
<ContentTemplate>
<div style="color: red; font-weight: bold;">WARNING</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="80"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Result: Annotation positioned at axis value 75.
With Multiple Axes
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<!-- Annotation on first axis -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="50" AxisIndex="0">
<ContentTemplate>
<span style="color: blue;">Axis 1: 50</span>
</ContentTemplate>
</LinearGaugeAnnotation>
<!-- Annotation on second axis -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="30" AxisIndex="1">
<ContentTemplate>
<span style="color: green;">Axis 2: 30</span>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="50"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
<LinearGaugeAxis Minimum="0" Maximum="50" OpposedPosition="true">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="30"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Properties:
- AxisValue: Value on the axis where annotation appears
- AxisIndex: Index of the axis (0-based) for multi-axis gauges
Alignment Options
Control horizontal and vertical alignment when X and Y are not specified.
Alignment values:
Placement.Center- Center alignment (default)Placement.Far- Far edge (right/bottom)Placement.Near- Near edge (left/top)Placement.None- No specific alignment
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1"
HorizontalAlignment="Syncfusion.Blazor.LinearGauge.Placement.Center"
VerticalAlignment="Syncfusion.Blazor.LinearGauge.Placement.Center">
<ContentTemplate>
<div class="custom-annotation">40</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="40"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style>
.custom-annotation {
color: white;
background-color: blue;
height: 30px;
width: 30px;
border-radius: 15px;
padding: 4px 0 0 6px;
font-weight: bold;
}
</style>Result: Annotation centered both horizontally and vertically on the gauge.
Note: HorizontalAlignment and VerticalAlignment are not effective when X and Y properties are set.
Customization
Z-Index Layering
Control the stacking order of overlapping annotations using ZIndex.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<!-- Background annotation (lower z-index) -->
<LinearGaugeAnnotation AxisValue="50" ZIndex="0" X="-20" Y="0">
<ContentTemplate>
<div style="background: lightgray; padding: 25px; border-radius: 8px;">
Background
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
<!-- Foreground annotation (higher z-index) -->
<LinearGaugeAnnotation AxisValue="50" ZIndex="2" X="0" Y="0">
<ContentTemplate>
<div style="background: blue; color: white; padding: 5px; border-radius: 4px;">
Foreground
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="50"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Higher ZIndex = Appears on top
Styled Annotations
Apply CSS styles for enhanced visual appearance.
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1" AxisValue="60" X="-50" Y="10">
<ContentTemplate>
<div class="styled-annotation">
<div class="annotation-title">Current Value</div>
<div class="annotation-value">60</div>
<div class="annotation-unit">°C</div>
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="60"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style>
.styled-annotation {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 15px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-align: center;
min-width: 100px;
}
.annotation-title {
font-size: 12px;
opacity: 0.9;
margin-bottom: 5px;
}
.annotation-value {
font-size: 28px;
font-weight: bold;
margin-bottom: 5px;
}
.annotation-unit {
font-size: 14px;
opacity: 0.9;
}
</style>Multiple Annotations
Add multiple annotations to display various pieces of information simultaneously.
Basic Multiple Annotations
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<!-- Title annotation -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="100" X="-110" Y="-35">
<ContentTemplate>
<div class="custom-annotation">Speed to get higher mileage</div>
</ContentTemplate>
</LinearGaugeAnnotation>
<!-- Value annotation -->
<LinearGaugeAnnotation AxisValue="0" ZIndex="1">
<ContentTemplate>
<div class="speed">40</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="40"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style>
.speed {
color: white;
background-color: blue;
height: 30px;
width: 30px;
border-radius: 15px;
padding: 4px 0 0 6px;
font-weight: bold;
}
.custom-annotation {
background-color: lightgray;
width: 210px;
padding: 2px 5px;
}
</style>Annotated Zones
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Width="200px" Height="450px">
<LinearGaugeAnnotations>
<!-- Low zone label -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="15" X="-60" Y="0">
<ContentTemplate>
<span style="color: #28a745; font-weight: bold;">SAFE</span>
</ContentTemplate>
</LinearGaugeAnnotation>
<!-- Medium zone label -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="50" X="-95" Y="0">
<ContentTemplate>
<span style="color: #ffc107; font-weight: bold;">WARNING</span>
</ContentTemplate>
</LinearGaugeAnnotation>
<!-- High zone label -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="85" X="-85" Y="0">
<ContentTemplate>
<span style="color: #dc3545; font-weight: bold;">DANGER</span>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugeRanges>
<LinearGaugeRange Start="0" End="30" Color="#4CAF50"
StartWidth="20" EndWidth="20">
</LinearGaugeRange>
<LinearGaugeRange Start="30" End="70" Color="#FFC107"
StartWidth="20" EndWidth="20">
</LinearGaugeRange>
<LinearGaugeRange Start="70" End="100" Color="#F44336"
StartWidth="20" EndWidth="20">
</LinearGaugeRange>
</LinearGaugeRanges>
<LinearGaugePointers>
<LinearGaugePointer PointerValue="65"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Use case: Labeling ranges, providing zone descriptions.
Practical Examples
Dynamic Value Display
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Width="200px" Height="400px">
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1" AxisValue="@currentValue" X="-80" Y="0">
<ContentTemplate>
<div class="value-display">
<div class="value">@currentValue.ToString("F1")</div>
<div class="unit">km/h</div>
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="200">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="@currentValue"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
@code {
private double currentValue = 85.5;
}
<style>
.value-display {
background: #007bff;
color: white;
padding: 10px 15px;
border-radius: 6px;
text-align: center;
}
.value {
font-size: 24px;
font-weight: bold;
}
.unit {
font-size: 12px;
opacity: 0.9;
}
</style>Threshold Indicator
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge>
<LinearGaugeAnnotations>
<!-- Threshold marker -->
<LinearGaugeAnnotation ZIndex="1" AxisValue="75" X="20" Y="0">
<ContentTemplate>
<div style="display: flex; align-items: center;">
<div style="width: 0; height: 0;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 12px solid red;">
</div>
<span style="color: red; font-weight: bold; margin-left: 5px;">
MAX
</span>
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="85" Color="#dc3545">
</LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>Information Panel
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Width="250px" Height="450px">
<LinearGaugeAnnotations>
<LinearGaugeAnnotation ZIndex="1" HorizontalAlignment="Syncfusion.Blazor.LinearGauge.Placement.Center"
VerticalAlignment="Syncfusion.Blazor.LinearGauge.Placement.Far"
Y="-20">
<ContentTemplate>
<div class="info-panel">
<div class="info-row">
<span class="label">Current:</span>
<span class="value">65°C</span>
</div>
<div class="info-row">
<span class="label">Max:</span>
<span class="value">85°C</span>
</div>
<div class="info-row">
<span class="label">Status:</span>
<span class="value status-ok">NORMAL</span>
</div>
</div>
</ContentTemplate>
</LinearGaugeAnnotation>
</LinearGaugeAnnotations>
<LinearGaugeAxes>
<LinearGaugeAxis Minimum="0" Maximum="100">
<LinearGaugePointers>
<LinearGaugePointer PointerValue="65"></LinearGaugePointer>
</LinearGaugePointers>
</LinearGaugeAxis>
</LinearGaugeAxes>
</SfLinearGauge>
<style>
.info-panel {
background: white;
border: 1px solid #dee2e6;
border-radius: 6px;
padding: 15px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.info-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
}
.info-row:last-child {
margin-bottom: 0;
}
.label {
font-weight: 600;
color: #6c757d;
}
.value {
color: #212529;
}
.status-ok {
color: #28a745;
font-weight: bold;
}
</style>Key Takeaways
1. Purpose: Annotations add custom content to specific gauge areas 2. Content Types: Text (Content), HTML (ContentTemplate), or dynamic templates 3. Positioning: Use AxisValue for value-aligned or X/Y for pixel positioning 4. Alignment: HorizontalAlignment and VerticalAlignment when X/Y not set 5. Layering: Control overlap with ZIndex property 6. Multiple Axes: Use AxisIndex for multi-axis gauge annotations 7. Styling: Apply custom CSS for enhanced visual design
Annotations provide flexible ways to add context, labels, values, and custom visuals to enhance gauge readability and user understanding.
Blazor Linear Gauge API Reference
Complete API documentation for the Syncfusion Blazor Linear Gauge component. This reference covers all properties, methods, events, and component classes available in the Syncfusion.Blazor.LinearGauge namespace.
Official Documentation: Syncfusion Blazor Linear Gauge API
Table of Contents
- SfLinearGauge Component
- Methods
- Properties
- Axes API
- Pointers API
- Ranges API
- Annotations API
- Tooltips API
- Gradients API
- Events API
- Enums
- Event Arguments
- Complete Component List
---
SfLinearGauge Component
The root component that hosts all gauge elements. This is the main container for the linear gauge visualization.
Methods
All methods are asynchronous and must be awaited.
SetPointerValueAsync
Updates a pointer's value programmatically.
public async Task SetPointerValueAsync(int axisIndex, int pointerIndex, double value)Parameters:
axisIndex(int): Zero-based index of the axispointerIndex(int): Zero-based index of the pointer on that axisvalue(double): New pointer value
Example:
await gauge.SetPointerValueAsync(0, 0, 85); // Set first pointer of first axis to 85Use Cases:
- Real-time sensor data updates
- Progress tracking
- Live metrics display
- Data synchronization
---
SetAnnotationValueAsync
Updates an annotation's content dynamically.
public async Task SetAnnotationValueAsync(int annotationIndex, string content)Parameters:
annotationIndex(int): Zero-based index of the annotationcontent(string): New HTML content for the annotation
Example:
await gauge.SetAnnotationValueAsync(0, "<div style='color: red;'>Warning!</div>");Use Cases:
- Dynamic status labels
- Live value displays
- Contextual messages
- Conditional alerts
---
RefreshAsync
Refreshes the entire gauge to apply configuration changes.
public async Task RefreshAsync()Use Cases:
- After programmatic property changes
- Theme switching
- Configuration updates
- Responsive layout adjustments
Example:
backgroundColor = "#2c3e50";
await gauge.RefreshAsync();---
PrintAsync
Prints the gauge to paper or PDF.
public async Task PrintAsync()Prerequisites:
- Must set
AllowPrint="true"on SfLinearGauge component
Example:
@using Syncfusion.Blazor.LinearGauge
<button @onclick="PrintGauge">Print Gauge</button>
<SfLinearGauge @ref="gauge" AllowPrint="true">
<!-- gauge content -->
</SfLinearGauge>
@code {
SfLinearGauge gauge;
private async Task PrintGauge()
{
await gauge.PrintAsync();
}
}---
ExportAsync
Exports the gauge to PNG, SVG, or PDF format.
public async Task ExportAsync(ExportType type, string fileName,
PdfPageOrientation? orientation = null, bool allowDownload = true)Parameters:
type(ExportType):PNG,SVG, orPDFfileName(string): Name for exported file (without extension)orientation(PdfPageOrientation?):PortraitorLandscape(PDF only)allowDownload(bool): Download file to browser (default: true)
Prerequisites:
AllowPdfExport="true"for PDF exportAllowImageExport="true"for PNG/SVG export
Examples:
// Export as PNG
await gauge.ExportAsync(ExportType.PNG, "gauge-export");
// Export as PDF (landscape)
await gauge.ExportAsync(ExportType.PDF, "gauge-report", PdfPageOrientation.Landscape);
// Export as SVG (save without automatic download)
await gauge.ExportAsync(ExportType.SVG, "gauge-vector", null, false);---
Properties
Sizing & Layout
| Property | Type | Description | Example |
|---|---|---|---|
Width | string | Width of the gauge container | "400px", "100%" |
Height | string | Height of the gauge container | "500px", "80vh" |
Orientation | Orientation | Horizontal or Vertical | Orientation.Vertical |
Description | string | Accessibility description | "Temperature gauge" |
Appearance
| Property | Type | Description | Example |
|---|---|---|---|
Title | string | Title text displayed on gauge | "System Temperature" |
TitleStyle | LinearGaugeTitleStyle | Title font and positioning | See TitleStyle |
Background | string | Background color | "#ffffff", "transparent" |
Theme | Theme | Predefined color theme | Theme.Material, Theme.Bootstrap |
Container | LinearGaugeContainer | Container appearance and border | See Container API |
Margin | LinearGaugeMargin | Left, right, top, bottom margins | new LinearGaugeMargin { Left = 10 } |
Behavior
| Property | Type | Description | Example |
|---|---|---|---|
AnimationDuration | double | Animation duration in milliseconds | 1000 (1 second), 0 (instant) |
Format | string | Number format for axis labels | "N2" (2 decimal places) |
EnableGroupingSeparator | bool | Show thousand separators | true, false |
ID | string | Unique component identifier | "gauge1", "temp-gauge" |
TabIndex | int | Tab order for keyboard navigation | 1, 2, 3 |
Export & Print
| Property | Type | Description | Example |
|---|---|---|---|
AllowPrint | bool | Enable print functionality | true, false |
AllowPdfExport | bool | Enable PDF export | true, false |
AllowImageExport | bool | Enable PNG/SVG export | true, false |
AllowMargin | bool | Include margins when printing/exporting | true, false |
Styling
| Property | Type | Description |
|---|---|---|
RangePalettes | string[] | Automatic color palette for ranges |
---
Properties
Complete Property Reference
SfLinearGauge Properties
// Sizing
public string Width { get; set; }
public string Height { get; set; }
// Layout & Appearance
public Orientation Orientation { get; set; }
public string Title { get; set; }
public LinearGaugeTitleStyle TitleStyle { get; set; }
public string Background { get; set; }
public Theme Theme { get; set; }
public LinearGaugeContainer Container { get; set; }
public LinearGaugeMargin Margin { get; set; }
public LinearGaugeBorder Border { get; set; }
// Behavior
public double AnimationDuration { get; set; }
public string Format { get; set; }
public bool EnableGroupingSeparator { get; set; }
// Identification & Accessibility
public string ID { get; set; }
public int TabIndex { get; set; }
public string Description { get; set; }
// Export & Print
public bool AllowPrint { get; set; }
public bool AllowPdfExport { get; set; }
public bool AllowImageExport { get; set; }
public bool AllowMargin { get; set; }
// Collections
public LinearGaugeAxes Axes { get; set; }
public LinearGaugeAnnotations Annotations { get; set; }
public LinearGaugeTooltipSettings TooltipSettings { get; set; }
public LinearGaugeEvents Events { get; set; }---
Axes API
Configure gauge scales with multiple axes, each with its own range, ticks, labels, pointers, and ranges.
LinearGaugeAxis
Defines a single scale on the gauge.
Properties
Scale Configuration:
public class LinearGaugeAxis
{
// Scale definition
public double Minimum { get; set; } // Minimum value
public double Maximum { get; set; } // Maximum value
public bool IsInversed { get; set; } // Reverse direction
public bool OpposedPosition { get; set; } // Opposite side
public bool ShowLastLabel { get; set; } // Show last label
// Child components
public LinearGaugeLine Line { get; set; }
public LinearGaugeMajorTicks MajorTicks { get; set; }
public LinearGaugeMinorTicks MinorTicks { get; set; }
public LinearGaugeAxisLabelStyle LabelStyle { get; set; }
public LinearGaugeContainer Container { get; set; }
public LinearGaugePointers Pointers { get; set; }
public LinearGaugeRanges Ranges { get; set; }
public LinearGradient LinearGradient { get; set; }
public LinearGaugeRadialGradient RadialGradient { get; set; }
}LinearGaugeLine
Defines the axis line appearance.
public class LinearGaugeLine
{
public double Height { get; set; } // Height of line
public double Width { get; set; } // Width of line
public string Color { get; set; } // Color
public double Offset { get; set; } // Offset from axis
}LinearGaugeMajorTicks
Major tick marks on the axis.
public class LinearGaugeMajorTicks
{
public double Interval { get; set; } // Interval between ticks
public double Height { get; set; } // Height of tick marks
public double Width { get; set; } // Width of tick marks
public string Color { get; set; } // Color
public Position Position { get; set; } // Inside/Outside/Cross
public double Offset { get; set; } // Offset from axis
}LinearGaugeMinorTicks
Minor tick marks on the axis.
public class LinearGaugeMinorTicks
{
public double Interval { get; set; } // Interval between ticks
public double Height { get; set; } // Height of tick marks
public double Width { get; set; } // Width of tick marks
public string Color { get; set; } // Color
public Position Position { get; set; } // Position relative to axis
public double Offset { get; set; } // Offset from axis
}LinearGaugeAxisLabelStyle
Axis label styling and positioning.
public class LinearGaugeAxisLabelStyle
{
public string Format { get; set; } // Format: "{value}°C"
public Position Position { get; set; } // Label position
public double Offset { get; set; } // Distance from axis
public string FontFamily { get; set; } // Font family
public string Color { get; set; } // Label color
public double Opacity { get; set; } // Opacity (0-1)
}LinearGaugeAxisLabelFont
Font properties for axis labels.
public class LinearGaugeAxisLabelFont
{
public string FontFamily { get; set; } // Font family name
public string FontSize { get; set; } // Font size (e.g., "14px")
public string FontStyle { get; set; } // normal, italic, oblique
public string FontWeight { get; set; } // normal, bold, 100-900
}---
Pointers API
Configure value indicators (pointers) on the gauge.
LinearGaugePointer
Represents a single pointer/indicator on an axis.
public class LinearGaugePointer
{
// Value & Type
public double PointerValue { get; set; } // Pointer value
public PointerType Type { get; set; } // Marker or Bar
public MarkerType MarkerType { get; set; } // Circle, Rectangle, etc.
// Appearance
public string Color { get; set; } // Pointer color
public double Width { get; set; } // Pointer width
public double Height { get; set; } // Pointer height
public double Opacity { get; set; } // Opacity (0-1)
public double Offset { get; set; } // Offset from axis
public Placement Placement { get; set; } // Center, Near, Far
public double RoundedCornerRadius { get; set; } // Corner radius
// Content
public string ImageUrl { get; set; } // Image pointer URL
public string Text { get; set; } // Text pointer content
// Interaction
public bool EnableDrag { get; set; } // Allow dragging
public double AnimationDuration { get; set; } // Animation duration
// Styling
public LinearGaugePointerBorder Border { get; set; }
public LinearGaugeMarkerTextStyle TextStyle { get; set; }
}LinearGaugePointerBorder
Pointer border styling.
public class LinearGaugePointerBorder
{
public string Color { get; set; } // Border color
public double Width { get; set; } // Border width
}LinearGaugeMarkerTextStyle
Text styling for text pointers.
public class LinearGaugeMarkerTextStyle
{
public string FontFamily { get; set; } // Font family
public string FontSize { get; set; } // Font size
public string Color { get; set; } // Text color
public string FontWeight { get; set; } // Font weight
public double Opacity { get; set; } // Text opacity
}---
Ranges API
Configure color-coded value zones on the gauge.
LinearGaugeRange
Represents a single colored range.
public class LinearGaugeRange
{
// Range Definition
public double Start { get; set; } // Start value
public double End { get; set; } // End value
// Appearance
public string Color { get; set; } // Background color
public double StartWidth { get; set; } // Width at start
public double EndWidth { get; set; } // Width at end
public Position Position { get; set; } // Inside/Outside/Cross
public double Offset { get; set; } // Offset from axis
// Styling
public LinearGaugeRangeBorder Border { get; set; }
public LinearGaugeRangeTooltipSettings TooltipSettings { get; set; }
}LinearGaugeRangeBorder
Range border styling.
public class LinearGaugeRangeBorder
{
public string Color { get; set; } // Border color
public double Width { get; set; } // Border width
}LinearGaugeRangeTooltipSettings
Tooltip shown when hovering over a range.
public class LinearGaugeRangeTooltipSettings
{
public bool Enable { get; set; } // Enable tooltip
public string Format { get; set; } // Format: "{value}%"
public TooltipPosition Position { get; set; } // Tooltip position
public string Fill { get; set; } // Background color
public double Opacity { get; set; } // Opacity
public LinearGaugeRangeTooltipTextStyle TextStyle { get; set; }
public LinearGaugeRangeTooltipBorder Border { get; set; }
}---
Annotations API
Overlay text, HTML, or templated content on the gauge.
LinearGaugeAnnotation
Represents a single annotation overlay.
public class LinearGaugeAnnotation
{
// Content & Positioning
public double AxisValue { get; set; } // Position on axis
public int AxisIndex { get; set; } // Axis index
public double X { get; set; } // X pixel offset
public double Y { get; set; } // Y pixel offset
public int ZIndex { get; set; } // Layer order
public Alignment HorizontalAlignment { get; set; } // Horizontal align
public Alignment VerticalAlignment { get; set; } // Vertical align
// Content
public string Content { get; set; } // Text/HTML content
public RenderFragment ContentTemplate { get; set; } // Template content
// Styling
public LinearGaugeAnnotationFont Font { get; set; }
}LinearGaugeAnnotationFont
Font properties for annotations.
public class LinearGaugeAnnotationFont
{
public string FontFamily { get; set; } // Font family
public string FontSize { get; set; } // Font size
public string Color { get; set; } // Text color
public string FontWeight { get; set; } // Font weight
public double Opacity { get; set; } // Opacity
}---
Tooltips API
Configure tooltips for pointers and ranges.
LinearGaugeTooltipSettings
Tooltip configuration for pointers.
public class LinearGaugeTooltipSettings
{
public bool Enable { get; set; } // Enable tooltips
public string Format { get; set; } // Format: "{value}°C"
public TooltipPosition Position { get; set; } // Top/Bottom/Left/Right
public string Fill { get; set; } // Background color
public double Opacity { get; set; } // Opacity (0-1)
public bool ShowAtMousePosition { get; set; } // Show at cursor
public LinearGaugeTooltipTextStyle TextStyle { get; set; } // Text styling
public LinearGaugeTooltipBorder Border { get; set; } // Border styling
}LinearGaugeTooltipTextStyle
Tooltip text styling.
public class LinearGaugeTooltipTextStyle
{
public string FontFamily { get; set; } // Font family
public string FontSize { get; set; } // Font size
public string Color { get; set; } // Text color
public string FontWeight { get; set; } // Font weight
public double Opacity { get; set; } // Opacity
}LinearGaugeTooltipBorder
Tooltip border styling.
public class LinearGaugeTooltipBorder
{
public string Color { get; set; } // Border color
public double Width { get; set; } // Border width
}---
Gradients API
Apply gradient fills to gauge elements.
LinearGaugeLinearGradient
Linear gradient configuration.
public class LinearGaugeLinearGradient
{
public double StartValue { get; set; } // Start position
public double EndValue { get; set; } // End position
public ColorStops ColorStops { get; set; } // Gradient stops
}LinearGaugeRadialGradient
Radial gradient configuration.
public class LinearGaugeRadialGradient
{
public string Radius { get; set; } // Gradient radius
public InnerPosition InnerPosition { get; set; } // Inner circle
public OuterPosition OuterPosition { get; set; } // Outer circle
public ColorStops ColorStops { get; set; } // Gradient stops
}ColorStop
Individual gradient color stop.
public class ColorStop
{
public string Offset { get; set; } // Position: "0%", "50%", "100%"
public string Color { get; set; } // Color at position
public double Opacity { get; set; } // Opacity at position
}---
Events API
Handle gauge interactions and lifecycle events.
LinearGaugeEvents
Event handler component.
<LinearGaugeEvents
Load="OnLoad"
Loaded="OnLoaded"
AxisLabelRendering="OnAxisLabelRendering"
AnnotationRendering="OnAnnotationRendering"
ValueChange="OnValueChange"
TooltipRendering="OnTooltipRendering"
DragStart="OnDragStart"
DragMove="OnDragMove"
DragEnd="OnDragEnd"
AnimationComplete="OnAnimationComplete"
ResizeCompleted="OnResizeCompleted"
OnGaugeMouseDown="OnMouseDown"
OnGaugeMouseLeave="OnMouseLeave"
OnGaugeMouseUp="OnMouseUp"
Print="OnPrint">
</LinearGaugeEvents>Event Reference Table
| Event | Argument Type | Fires When | Properties |
|---|---|---|---|
Load | LoadEventArgs | Before gauge renders | Cancel (bool) |
Loaded | LoadedEventArgs | After gauge renders | None specific |
AxisLabelRendering | AxisLabelRenderEventArgs | Before each label renders | Text, Value, Axis |
AnnotationRendering | AnnotationRenderEventArgs | Before annotation renders | Content, Annotation |
ValueChange | ValueChangeEventArgs | Pointer value changes | Value, PointerIndex, AxisIndex |
TooltipRendering | TooltipRenderEventArgs | Before tooltip displays | Content, Pointer |
DragStart | PointerDragEventArgs | User starts dragging pointer | CurrentValue, PointerIndex, AxisIndex |
DragMove | PointerDragEventArgs | During pointer drag | CurrentValue, PointerIndex, AxisIndex |
DragEnd | PointerDragEventArgs | User releases pointer | CurrentValue, PointerIndex, AxisIndex |
AnimationComplete | AnimationCompleteEventArgs | Animation finishes | None specific |
ResizeCompleted | ResizeEventArgs | Gauge resized | CurrentSize, PreviousSize |
OnGaugeMouseDown | MouseEventArgs | Mouse down on gauge | Standard mouse properties |
OnGaugeMouseLeave | MouseEventArgs | Mouse leaves gauge | Standard mouse properties |
OnGaugeMouseUp | MouseEventArgs | Mouse up on gauge | Standard mouse properties |
Print | PrintEventArgs | Before printing | None specific |
Event Handler Examples
// Load event - can cancel rendering
private void OnLoad(LoadEventArgs args)
{
if (someCondition)
{
args.Cancel = true; // Prevent rendering
}
}
// Value change - track pointer updates
private void OnValueChange(ValueChangeEventArgs args)
{
double newValue = args.Value;
int pointerIndex = args.PointerIndex;
int axisIndex = args.AxisIndex;
}
// Axis label rendering - customize labels
private void OnAxisLabelRendering(AxisLabelRenderEventArgs args)
{
args.Text = args.Text + "°C"; // Add unit
}
// Drag events - track user interaction
private void OnDragStart(PointerDragEventArgs args)
{
Console.WriteLine($"Started dragging from {args.CurrentValue}");
}
private void OnDragMove(PointerDragEventArgs args)
{
double currentValue = args.CurrentValue;
// Live update feedback
}
private void OnDragEnd(PointerDragEventArgs args)
{
double finalValue = args.CurrentValue;
// Save or process final value
}
// Tooltip rendering - customize tooltip content
private void OnTooltipRendering(TooltipRenderEventArgs args)
{
args.Content = $"Temperature: {args.Content}°C";
}---
Enums
Orientation
Gauge layout direction.
public enum Orientation
{
Horizontal, // Horizontal scale (default)
Vertical // Vertical scale
}Position
Element positioning relative to axis line.
public enum Position
{
Inside, // Inside the axis
Outside, // Outside the axis
Cross // Crossing the axis line
}PointerType
Type of value indicator.
public enum PointerType
{
Marker, // Shaped marker (circle, square, etc.)
Bar // Bar/rectangle pointer
}MarkerType
Shape of marker pointer.
public enum MarkerType
{
Circle, // Circle marker
Rectangle, // Rectangle marker
Triangle, // Triangle marker
Diamond, // Diamond marker
InvertedTriangle // Inverted triangle marker
}Placement
Pointer position relative to axis.
public enum Placement
{
Center, // Centered on axis (default)
Near, // Near side
Far // Far side
}ContainerType
Container shape type.
public enum ContainerType
{
Normal, // Rectangular container (default)
RoundedRectangle, // Rounded rectangle
Thermometer // Thermometer shape
}ExportType
Export file format.
public enum ExportType
{
PNG, // PNG image format
SVG, // SVG vector format
PDF // PDF document format
}TooltipPosition
Tooltip placement relative to pointer.
public enum TooltipPosition
{
Top, // Above pointer
Bottom, // Below pointer
Left, // Left of pointer
Right // Right of pointer
}Theme
Predefined color themes.
public enum Theme
{
Bootstrap, // Bootstrap theme
Material, // Material Design
Fabric, // Fabric theme
Fluent, // Fluent Design
Tailwind, // Tailwind theme
Bootstrap5, // Bootstrap 5
FluentDark, // Fluent Dark theme
MaterialDark, // Material Dark
BootstrapDark, // Bootstrap Dark
TailwindDark, // Tailwind Dark
// ... additional themes
}Alignment
Horizontal/Vertical alignment.
public enum Alignment
{
Near, // Start/left alignment
Center, // Center alignment
Far // End/right alignment
}PdfPageOrientation
PDF page orientation.
public enum PdfPageOrientation
{
Portrait, // Vertical orientation
Landscape // Horizontal orientation
}---
Event Arguments
Complete details of all event argument classes.
LoadEventArgs
Fired before gauge rendering.
public class LoadEventArgs
{
public bool Cancel { get; set; } // Set to true to cancel rendering
}LoadedEventArgs
Fired after gauge successfully renders.
public class LoadedEventArgs
{
// No specific properties - just indicates gauge is ready
}ValueChangeEventArgs
Fired when pointer value changes.
public class ValueChangeEventArgs
{
public double Value { get; set; } // New pointer value
public int PointerIndex { get; set; } // Pointer index
public int AxisIndex { get; set; } // Axis index
}AxisLabelRenderEventArgs
Fired before axis label rendering.
public class AxisLabelRenderEventArgs
{
public string Text { get; set; } // Label text (modifiable)
public double Value { get; set; } // Numeric value
public LinearGaugeAxis Axis { get; set; } // Axis configuration
}AnnotationRenderEventArgs
Fired before annotation rendering.
public class AnnotationRenderEventArgs
{
public string Content { get; set; } // Annotation content (modifiable)
public LinearGaugeAnnotation Annotation { get; set; } // Annotation config
}TooltipRenderEventArgs
Fired before tooltip display.
public class TooltipRenderEventArgs
{
public string Content { get; set; } // Tooltip content (modifiable)
public LinearGaugePointer Pointer { get; set; } // Pointer configuration
}PointerDragEventArgs
Fired during pointer drag (DragStart, DragMove, DragEnd).
public class PointerDragEventArgs
{
public double CurrentValue { get; set; } // Current pointer value
public int PointerIndex { get; set; } // Pointer index
public int AxisIndex { get; set; } // Axis index
}ResizeEventArgs
Fired after gauge resize.
public class ResizeEventArgs
{
public Size CurrentSize { get; set; } // New gauge size
public Size PreviousSize { get; set; } // Previous gauge size
}MouseEventArgs
Fired for mouse events.
public class MouseEventArgs
{
// Standard mouse event properties
public int ClientX { get; set; }
public int ClientY { get; set; }
public int OffsetX { get; set; }
public int OffsetY { get; set; }
// ... and other standard properties
}PrintEventArgs
Fired before printing.
public class PrintEventArgs
{
// Event context for print operation
}AnimationCompleteEventArgs
Fired when animation completes.
public class AnimationCompleteEventArgs
{
// Event context for animation completion
}---
Complete Component List
All classes in the Syncfusion.Blazor.LinearGauge namespace.
Core Components (44 classes)
1. SfLinearGauge - Main gauge component 2. LinearGaugeAnnotation - Individual annotation 3. LinearGaugeAnnotationFont - Annotation font styling 4. LinearGaugeAnnotations - Annotation collection 5. LinearGaugeAxes - Axis collection 6. LinearGaugeAxis - Individual axis 7. LinearGaugeAxisLabelFont - Axis label font 8. LinearGaugeAxisLabelStyle - Axis label styling 9. LinearGaugeBorder - Main gauge border 10. LinearGaugeBorderSettings - Border settings 11. LinearGaugeContainer - Container configuration 12. LinearGaugeContainerBorder - Container border 13. LinearGaugeEvents - Event handlers 14. LinearGaugeFontSettings - Font configuration 15. LinearGaugeLine - Axis line 16. LinearGaugeLinearGradient - Linear gradient 17. LinearGaugeMajorTicks - Major tick marks 18. LinearGaugeMargin - Margin configuration 19. LinearGaugeMarginSettings - Margin settings 20. LinearGaugeMarkerTextStyle - Marker text styling 21. LinearGaugeMinorTicks - Minor tick marks 22. LinearGaugePointer - Individual pointer 23. LinearGaugePointerBorder - Pointer border 24. LinearGaugePointers - Pointer collection 25. LinearGaugeRadialGradient - Radial gradient 26. LinearGaugeRange - Individual range 27. LinearGaugeRangeBorder - Range border 28. LinearGaugeRangeTooltipBorder - Range tooltip border 29. LinearGaugeRangeTooltipSettings - Range tooltip 30. LinearGaugeRangeTooltipTextStyle - Range tooltip text 31. LinearGaugeRanges - Range collection 32. LinearGaugeTickSettings - Tick configuration 33. LinearGaugeTitleStyle - Title styling 34. LinearGaugeTooltipBorder - Tooltip border 35. LinearGaugeTooltipSettings - Tooltip configuration 36. LinearGaugeTooltipTextStyle - Tooltip text styling 37. LinearGaugeLinearGradient - Linear gradient definition 38. LinearGaugeRadialGradient - Radial gradient definition 39. ColorStop - Gradient color stop 40. ColorStops - Gradient color stops collection 41. Point - Pointer type enum 42. GradientPosition - Gradient position 43. InnerPosition - Inner gradient position 44. OuterPosition - Outer gradient position
Event Argument Classes (10 classes)
1. LoadEventArgs - Load event arguments 2. LoadedEventArgs - Loaded event arguments 3. AxisLabelRenderEventArgs - Axis label rendering arguments 4. AnnotationRenderEventArgs - Annotation rendering arguments 5. ValueChangeEventArgs - Value change arguments 6. TooltipRenderEventArgs - Tooltip rendering arguments 7. PointerDragEventArgs - Pointer drag arguments 8. ResizeEventArgs - Resize event arguments 9. MouseEventArgs - Mouse event arguments 10. PrintEventArgs - Print event arguments 11. AnimationCompleteEventArgs - Animation complete arguments
Enum Types (12 enums)
1. Orientation - Horizontal/Vertical 2. Position - Inside/Outside/Cross 3. PointerType - Marker/Bar 4. MarkerType - Circle/Rectangle/Triangle/Diamond/InvertedTriangle 5. Placement - Center/Near/Far 6. ContainerType - Normal/RoundedRectangle/Thermometer 7. ExportType - PNG/SVG/PDF 8. TooltipPosition - Top/Bottom/Left/Right 9. Theme - Various theme options 10. Alignment - Near/Center/Far 11. PdfPageOrientation - Portrait/Landscape 12. GradientPosition - Gradient positioning
---
Best Practices
1. Async Method Usage
Always await async methods and wrap in InvokeAsync when calling from non-UI contexts:
private async Task UpdatePointer()
{
await gauge.SetPointerValueAsync(0, 0, 85);
}
// From event handler
timer.Elapsed += async (sender, e) =>
{
await InvokeAsync(async () =>
{
await gauge.SetPointerValueAsync(0, 0, newValue);
});
};2. Animation Performance
For frequent updates, disable animation:
@using Syncfusion.Blazor.LinearGauge
<LinearGaugePointer PointerValue="@value"
AnimationDuration="0">
</LinearGaugePointer>3. Event Argument Modification
Only modify event arguments that are marked as modifiable:
private void OnAxisLabelRendering(AxisLabelRenderEventArgs args)
{
args.Text = args.Text + "%"; // ✓ Modifiable
}4. Index-Based Referencing
Always use zero-based indices:
// First axis, first pointer, first annotation
await gauge.SetPointerValueAsync(0, 0, 50);
await gauge.SetAnnotationValueAsync(0, "<div>50</div>");5. Accessibility
Provide descriptions and labels for accessibility:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Description="Temperature monitoring gauge"
ID="tempGauge"
Title="Temperature">
</SfLinearGauge>6. Export Prerequisites
Enable appropriate flags before exporting:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge AllowPdfExport="true"
AllowImageExport="true"
AllowPrint="true">
</SfLinearGauge>7. Theme Consistency
Use theme property for consistent styling across gauge:
@using Syncfusion.Blazor.LinearGauge
<SfLinearGauge Theme="Theme.Material">
<!-- All child components inherit theme -->
</SfLinearGauge>---
Common Implementation Patterns
Pattern 1: Real-Time Data Update
private async Task UpdateGaugeValue(double newValue)
{
if (gauge != null)
{
await gauge.SetPointerValueAsync(0, 0, newValue);
}
}Pattern 2: Range Validation
private void OnValueChange(ValueChangeEventArgs args)
{
if (args.Value < 0 || args.Value > 100)
{
// Invalid range
return;
}
// Process valid value
}Pattern 3: Custom Tooltips
private void OnTooltipRendering(TooltipRenderEventArgs args)
{
string formattedValue = ((double)Convert.ToDouble(args.Content))
.ToString("F2");
args.Content = $"Value: {formattedValue}°C";
}Pattern 4: Export with Error Handling
private async Task ExportAsImage()
{
try
{
await gauge.ExportAsync(ExportType.PNG, "gauge-report");
}
catch (Exception ex)
{
Console.WriteLine($"Export failed: {ex.Message}");
}
}---
Reference Links
- Official API Documentation
- Getting Started Guide
- Axes Configuration
- Pointers Guide
- Ranges Guide
- Methods and Events