Implementing Syncfusion Blazor Charts
NuGet: Syncfusion.Blazor.Charts + Syncfusion.Blazor.Themes
Namespace: Syncfusion.Blazor.Charts
A comprehensive guide for implementing the Syncfusion Blazor Chart component to create interactive, feature-rich data visualizations in Blazor applications. The Chart component supports 33+ chart types, multiple axes, advanced interactivity, and extensive customization options.
When to Use This Skill
Use this skill when you need to:
- Create data visualizations in Blazor applications (line, column, bar, area, etc.)
- Implement financial charts for stock analysis (candle, HILO, HILOOC)
- Build statistical visualizations (histogram, box-whisker, pareto, waterfall)
- Display comparative data with stacked or grouped charts
- Show range-based data with range area/column charts
- Create polar or radar charts for circular data representation
- Add interactive features like tooltips, zooming, crosshair, selection
- Customize chart appearance with themes, gradients, annotations
- Handle dynamic data with live updates and data editing
- Implement accessible charts with ARIA support and internationalization
Component Overview
The Syncfusion Blazor Chart component is a powerful data visualization tool that provides:
- 33+ Chart Types: Line, Column, Bar, Area, Spline, Scatter, Bubble, Candle, HILO, Polar, Radar, and more
- Multiple Axes: Support for category, numeric, datetime, and logarithmic axes
- Rich Interactivity: Zooming, panning, crosshair, trackball, tooltips, selection
- Data Binding: Work with List, DataManager, dynamic updates, and live data
- Visual Elements: Markers, data labels, annotations, legends, gradients
- Advanced Features: Technical indicators, trend lines, strip lines, multiple panes
- Accessibility: Full ARIA support, keyboard navigation, localization, RTL
- Customization: Themes, responsive design, print support, adaptive layout
Documentation and Navigation Guide
Complete API Reference
📄 Read: references/api-reference.md
CRITICAL: Use this reference FIRST for all API-related questions
Use this authoritative API reference when:
- Looking up correct enum values (ChartSeriesType, ValueType, SelectionMode, etc.)
- Finding public method signatures (RefreshAsync, ExportAsync, ShowTooltip, etc.)
- Verifying property names and types
- Generating code samples
- Troubleshooting API-related issues
Topics covered:
- Complete list of SfChart public methods with signatures
- All chart enumerations with correct values
- Key component classes and their properties
- Method usage examples
- Common patterns and best practices
Key Points:
- All enum values are exact - do not use variations
- Method names follow C# conventions (e.g.,
RefreshAsync not Refresh)
- Always use
@ref to access chart instance for method calls
- Namespace:
Syncfusion.Blazor.Charts
Getting Started
📄 Read: references/getting-started.md
Use this when:
- Setting up a new Blazor Chart project
- Installing NuGet packages and configuring services
- Creating your first chart component
- Understanding basic chart structure and data binding
- Working with Visual Studio, VS Code, or .NET CLI
Topics covered:
- Installation and prerequisites
- Package setup (Syncfusion.Blazor.Charts)
- Namespace imports and service registration
- Script references
- Basic chart implementation
- Simple data binding example
Chart Types
Common Chart Types
📄 Read: references/chart-types-common.md
Use this for frequently-used chart types:
- Line charts for trend visualization
- Area charts for showing magnitude over time
- Column charts for categorical comparisons
- Bar charts for horizontal comparisons
- Spline charts for smooth curves
- Step charts for stepped data progression
Topics covered:
- Line, Area, Column, Bar chart implementations
- Spline and Spline Area variations
- Step Line and Step Area patterns
- When to use each chart type
- Configuration and customization
- Multi-series examples
Specialized Chart Types
📄 Read: references/chart-types-specialized.md
Use this for specialized visualization needs:
- Financial charts (Candle, HILO, HILOOC)
- Statistical charts (Box-Whisker, Histogram, Error Bar, Pareto, Waterfall)
- Stacked charts (Stack Area/Bar/Column/Line)
- Range charts (Range Area/Column/Step Area)
- Polar and Radar charts
- Scatter and Bubble charts
- Vertical chart orientation
Topics covered:
- Financial chart patterns and configurations
- Statistical analysis chart types
- Stacking modes (normal vs 100%)
- Range visualization techniques
- Circular chart layouts
- XY scatter relationships
- Chart orientation options
Axes and Data Configuration
📄 Read: references/axes-and-scales.md
Use this when:
- Configuring axis types (category, numeric, datetime, logarithmic)
- Customizing axis appearance and behavior
- Formatting axis labels and values
- Working with multiple axes
- Setting axis ranges and intervals
Topics covered:
- Category axis for discrete data
- Numeric axis for continuous values
- DateTime axis for time-series data
- Logarithmic axis for exponential data
- Axis customization (title, range, interval)
- Label formatting, rotation, and positioning
- Multiple axis configuration
- Inverse and opposed axes
📄 Read: references/data-handling.md
Use this when:
- Binding data sources to charts
- Adding, removing, or updating data dynamically
- Enabling data editing
- Sorting chart data
- Working with live or streaming data
Topics covered:
- Data source binding (List, DataManager)
- Dynamic data operations
- Data editing functionality
- Chart sorting options
- Real-time data updates
- Data serialization patterns
Visual Elements
📄 Read: references/visual-elements.md
Use this when:
- Adding data markers to chart points
- Displaying data labels on series
- Creating custom label templates
- Adding annotations (text, shapes, images)
- Applying gradient fills
Topics covered:
- Data marker types and customization
- Data label visibility and formatting
- Label positioning strategies
- Data label templates
- Displaying series labels for series identification
- Last data label highlighting
- Chart annotations (text, shapes, images)
- Gradient color fills
📄 Read: references/legend.md
Use this when:
- Enabling and configuring chart legend
- Positioning legend (top, bottom, left, right)
- Customizing legend appearance
- Implementing legend click behavior
- Creating custom legend templates
Topics covered:
- Legend visibility and positioning
- Legend shape and text customization
- Interactive legend (toggle series)
- Legend pagination
- Custom legend templates
- Legend alignment options
Interactive Features
📄 Read: references/interactive-features.md
Use this when:
- Enabling tooltips with custom formatting
- Adding crosshair or trackball for data tracking
- Implementing point, series, or cluster selection
- Enabling zooming and panning
- Creating interactive user experiences
Topics covered:
- Tooltip configuration and templates
- Crosshair and trackball features
- Selection modes and patterns
- Zoom types (selection, pinch, mousewheel)
- Zoom toolbar configuration
- Pan functionality
- User interaction events
Customization and Appearance
📄 Read: references/appearance-styling.md
Use this when:
- Customizing chart appearance and themes
- Setting chart dimensions and sizing
- Configuring responsive/adaptive layout
- Enabling print functionality
- Styling background, borders, and margins
Topics covered:
- Chart appearance customization
- Theme configuration
- Chart dimensions and sizing
- Responsive design patterns
- Adaptive layout for mobile
- Print support
- Background and border styling
- Gradient customization
📄 Read: references/advanced-features.md
Use this when:
- Adding technical indicators (EMA, SMA, RSI, etc.)
- Implementing trend lines (linear, exponential, polynomial)
- Creating strip lines (horizontal/vertical bands)
- Using multiple panes (sub-charts)
- Handling empty points
Topics covered:
- Technical indicators for financial charts
- Trend line types and configuration
- Strip line patterns
- Multiple pane layouts
- Empty point handling strategies
- Row and column definitions
Accessibility and Internationalization
📄 Read: references/accessibility-internationalization.md
Use this when:
- Implementing accessible charts (ARIA, keyboard nav)
- Configuring advanced accessibility features
- Enabling internationalization (i18n)
- Setting up localization (l10n)
- Supporting RTL layouts
Topics covered:
- Accessibility features and ARIA support
- Keyboard navigation patterns
- Advanced accessibility configuration
- Internationalization setup
- Localization resources
- RTL support
- Screen reader compatibility
Events
📄 Read: references/events.md
Use this when:
- Handling chart lifecycle events
- Responding to user interactions (clicks, mouse events)
- Listening to axis, series, or point events
- Implementing custom event handlers
- Triggering actions on zoom, pan, or selection
Topics covered:
- Chart load and render events
- Point and series events
- Mouse events (click, move, leave)
- Axis label render events
- Legend events
- Zoom and pan events
- Selection events
- Event handler patterns
Practical Examples and How-To Guides
📄 Read: references/practical-examples.md
Use this for common implementation scenarios:
- Adding/removing series dynamically
- Hiding axes programmatically
- Converting milliseconds to datetime
- Updating points dynamically
- Implementing lazy loading
- Creating live/real-time charts
- Getting selected data
- Synchronizing multiple charts
- Adding threshold lines
- Custom tooltip tables
Topics covered:
- Dynamic series management
- Axis visibility control
- Date conversion techniques
- Dynamic point updates
- Lazy loading patterns
- Live chart implementation
- Selection data retrieval
- Chart synchronization
- Threshold line implementation
- Custom tooltip tables
Public Methods Reference
The SfChart component provides several public methods for programmatic control. Always use @ref to access these methods:
Essential Methods
<SfChart @ref="ChartRef">
<!-- Configuration -->
</SfChart>
@code {
SfChart ChartRef;
// Refresh the chart
async Task RefreshChart() => await ChartRef.RefreshAsync();
// Export the chart
async Task ExportChart() => await ChartRef.ExportAsync(ExportType.PNG, "chart.png");
// Print the chart
async Task PrintChart() => await ChartRef.PrintAsync();
// Show/Hide tooltip
void ShowChartTooltip() => ChartRef.ShowTooltip("January", 35);
void HideChartTooltip() => ChartRef.HideTooltip();
// Show/Hide crosshair
void ShowChartCrosshair() => ChartRef.ShowCrosshair(100, 50);
void HideChartCrosshair() => ChartRef.HideCrosshair();
// Selection control
void ClearSelections() => ChartRef.ClearSelection();
// Sorting
void SortData() => ChartRef.Sort("YValue", ListSortDirection.Descending);
void ClearChartSort() => ChartRef.ClearSort();
}
See references/api-reference.md for complete method documentation.
⚠️ CRITICAL: API Usage Guidelines
1. Enum Names - MUST Use Full Namespace
Syncfusion Blazor Charts requires FULLY QUALIFIED enum names:
<!-- ✅ CORRECT - Use full namespace -->
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartSeries Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column" />
<!-- ❌ WRONG - Short form will cause errors -->
<ChartPrimaryXAxis ValueType="ValueType.Category" />
<ChartSeries Type="ChartSeriesType.Column" />
Always use Syncfusion.Blazor.Charts. prefix for:
ValueType (Category, Double, DateTime, etc.)
ChartSeriesType (Column, Line, Area, etc.)
LegendPosition, SelectionMode, ZoomMode, ChartShape, etc.
2. Component Property Restrictions
⚠️ Common Property Errors to Avoid:
ChartCrosshairLine - Limited Properties
<!-- ✅ CORRECT - Only Width and Color supported -->
<ChartCrosshairSettings Enable="true">
<ChartCrosshairLine Width="1" Color="#666"></ChartCrosshairLine>
</ChartCrosshairSettings>
<!-- ❌ WRONG - DashArray NOT supported on ChartCrosshairLine -->
<ChartCrosshairLine Width="1" Color="#666" DashArray="5,5"></ChartCrosshairLine>
Supported ChartCrosshairLine Properties:
Width - Line width (number)
Color - Line color (string)
NOT Supported:
- ❌
DashArray - Will cause runtime error
- ❌
Opacity - Not available on this component
Striplines - Use Plural Form
<!-- ✅ CORRECT - ChartStriplines (plural) -->
<ChartPrimaryYAxis>
<ChartStriplines>
<ChartStripline Start="50" End="60" Color="red" />
</ChartStriplines>
</ChartPrimaryYAxis>
<!-- ❌ WRONG - ChartAxisStripLineSettings does not exist -->
<ChartAxisStripLineSettings>
<ChartAxisStripLine Start="50" End="60" />
</ChartAxisStripLineSettings>
3. Validation Checklist
Before deploying, verify:
- ✅ All enums use
Syncfusion.Blazor.Charts. prefix
- ✅ ChartCrosshairLine uses ONLY Width and Color
- ✅ Striplines use
<ChartStriplines> and <ChartStripline>
- ✅ Component references use
@ref for method access
- ✅ Property names match official API exactly (case-sensitive)
Quick Start Example
Here's a minimal example to create a column chart with data:
@page "/chart-demo"
@using Syncfusion.Blazor.Charts
<SfChart Title="Sales Analysis">
<ChartPrimaryXAxis Title="Month" ValueType="Syncfusion.Blazor.Charts.ValueType.Category">
</ChartPrimaryXAxis>
<ChartPrimaryYAxis Title="Sales in Dollar">
</ChartPrimaryYAxis>
<ChartTooltipSettings Enable="true"></ChartTooltipSettings>
<ChartSeriesCollection>
<ChartSeries DataSource="@SalesData"
Name="Sales"
XName="Month"
YName="SalesValue"
Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
<ChartMarker>
<ChartDataLabel Visible="true"></ChartDataLabel>
</ChartMarker>
</ChartSeries>
</ChartSeriesCollection>
</SfChart>
@code {
public class SalesInfo
{
public string Month { get; set; }
public double SalesValue { get; set; }
}
public List<SalesInfo> SalesData = new List<SalesInfo>
{
new SalesInfo { Month = "Jan", SalesValue = 35 },
new SalesInfo { Month = "Feb", SalesValue = 28 },
new SalesInfo { Month = "Mar", SalesValue = 34 },
new SalesInfo { Month = "Apr", SalesValue = 32 },
new SalesInfo { Month = "May", SalesValue = 40 },
new SalesInfo { Month = "Jun", SalesValue = 32 }
};
}
Prerequisites:
- Install
Syncfusion.Blazor.Charts NuGet package
- Add
@using Syncfusion.Blazor.Charts to _Imports.razor
- Register service:
builder.Services.AddSyncfusionBlazor(); in Program.cs
- Add script reference in
App.razor
Common Patterns
Multi-Series Comparison Chart
<SfChart Title="Product Sales Comparison">
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@Product1Sales" XName="Month" YName="Sales"
Name="Product 1" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
</ChartSeries>
<ChartSeries DataSource="@Product2Sales" XName="Month" YName="Sales"
Name="Product 2" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
</ChartSeries>
</ChartSeriesCollection>
<ChartLegendSettings Visible="true"></ChartLegendSettings>
</SfChart>
Time-Series Line Chart with Zooming
<SfChart>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime"
Title="Date">
</ChartPrimaryXAxis>
<ChartZoomSettings EnableSelectionZooming="true"
EnablePan="true"
EnableMouseWheelZooming="true">
</ChartZoomSettings>
<ChartSeriesCollection>
<ChartSeries DataSource="@TimeSeriesData"
XName="Date"
YName="Value"
Type="Syncfusion.Blazor.Charts.ChartSeriesType.Line">
</ChartSeries>
</ChartSeriesCollection>
</SfChart>
Stacked Area Chart with Legend
<SfChart Title="Resource Allocation">
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@ResourceData1" XName="Period" YName="Hours"
Name="Development" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
</ChartSeries>
<ChartSeries DataSource="@ResourceData2" XName="Period" YName="Hours"
Name="Testing" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
</ChartSeries>
<ChartSeries DataSource="@ResourceData3" XName="Period" YName="Hours"
Name="Documentation" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
</ChartSeries>
</ChartSeriesCollection>
<ChartLegendSettings Visible="true" Position="Syncfusion.Blazor.Charts.LegendPosition.Bottom">
</ChartLegendSettings>
</SfChart>
Key Configuration Properties
Chart Component (SfChart)
Title - Chart title text
Width / Height - Chart dimensions (accepts px or %, default: "100%")
Theme - Visual theme (see Theme enum in API reference)
Background - Chart background color
EnableAnimation - Enable/disable animation (default: true)
SelectionMode - Selection mode (None, Series, Point, Cluster, DragXY, DragX, DragY, Lasso)
HighlightMode - Highlight mode (None, Series, Point, Cluster)
Primary Axes (ChartPrimaryXAxis, ChartPrimaryYAxis)
ValueType - Axis type: Syncfusion.Blazor.Charts.ValueType.Category, ValueType.Double, ValueType.DateTime, ValueType.Logarithmic, ValueType.DateTimeCategory
Title - Axis title
Minimum / Maximum - Axis range
Interval - Spacing between labels
LabelFormat - Format string for labels (e.g., "C0", "N2", "dd MMM")
EdgeLabelPlacement - Edge label handling (None, Hide, Shift)
LabelIntersectAction - Label intersection handling (None, Hide, Trim, Wrap, MultipleRows, Rotate45, Rotate90)
- Striplines - Use
<ChartStriplines> (plural) for horizontal/vertical bands
Series (ChartSeries)
DataSource - Data collection (IEnumerable)
XName / YName - Property names for X and Y values (case-sensitive)
Type - Chart type: Syncfusion.Blazor.Charts.ChartSeriesType.Column, ChartSeriesType.Line, etc. (see API reference)
Name - Series name for legend
Fill - Series color (CSS color string)
Width - Line/border width (pixels)
DashArray - Dash pattern (e.g., "5,5")
Opacity - Transparency (0 to 1)
Interactivity
ChartTooltipSettings - Tooltip configuration
Enable - Show/hide tooltip
Shared - Enable shared tooltip for multiple series
Format - Custom tooltip format
Template - Custom tooltip template (RenderFragment)
ChartZoomSettings - Zoom and pan options
EnableSelectionZooming - Enable selection-based zoom
EnableMouseWheelZooming - Enable mouse wheel zoom
EnablePinchZooming - Enable pinch zoom (touch devices)
EnablePan - Enable panning
Mode - Zoom mode (X, Y, XY)
SelectionMode - Selection behavior (see SelectionMode enum)
ChartCrosshairSettings - Crosshair configuration
Enable - Show/hide crosshair
LineType - Crosshair line type (Vertical, Horizontal, Both)
ChartCrosshairLine - Line style (Width, Color ONLY - NO DashArray)
Visual Elements
ChartMarker - Data point markers
Visible - Show/hide markers
Shape - Marker shape (see ChartShape enum)
Width / Height - Marker dimensions
ChartDataLabel - Data labels on points
Visible - Show/hide labels
Position - Label position
Template - Custom label template
SeriesLabelSettings - Series label visibility, text, overlap handling, and styling
ChartLegendSettings - Legend configuration
Visible - Show/hide legend
Position - Legend position (see LegendPosition enum)
ChartAnnotations - Custom annotations
- Support for text, images, and shapes
Additional Resources
1---2name: syncfusion-blazor-charts3description: Implement Syncfusion Blazor Chart (SfChart) component for comprehensive data visualization. Use this when creating line charts, bar/column charts, area charts, financial charts, or statistical visualizations. This skill covers 30+ chart types including scatter plots, bubble charts, candlestick charts, and specialized charts like waterfall, histogram, and polar charts for Blazor applications.4---5
6# Implementing Syncfusion Blazor Charts
7
8**NuGet:** `Syncfusion.Blazor.Charts` + `Syncfusion.Blazor.Themes`
9**Namespace:** `Syncfusion.Blazor.Charts`
10
11A comprehensive guide for implementing the Syncfusion Blazor Chart component to create interactive, feature-rich data visualizations in Blazor applications. The Chart component supports 33+ chart types, multiple axes, advanced interactivity, and extensive customization options.
12
13## When to Use This Skill
14
15Use this skill when you need to:
16- **Create data visualizations** in Blazor applications (line, column, bar, area, etc.)
17- **Implement financial charts** for stock analysis (candle, HILO, HILOOC)
18- **Build statistical visualizations** (histogram, box-whisker, pareto, waterfall)
19- **Display comparative data** with stacked or grouped charts
20- **Show range-based data** with range area/column charts
21- **Create polar or radar charts** for circular data representation
22- **Add interactive features** like tooltips, zooming, crosshair, selection
23- **Customize chart appearance** with themes, gradients, annotations
24- **Handle dynamic data** with live updates and data editing
25- **Implement accessible charts** with ARIA support and internationalization
26
27## Component Overview
28
29The Syncfusion Blazor Chart component is a powerful data visualization tool that provides:
30
31- **33+ Chart Types:** Line, Column, Bar, Area, Spline, Scatter, Bubble, Candle, HILO, Polar, Radar, and more
32- **Multiple Axes:** Support for category, numeric, datetime, and logarithmic axes
33- **Rich Interactivity:** Zooming, panning, crosshair, trackball, tooltips, selection
34- **Data Binding:** Work with List, DataManager, dynamic updates, and live data
35- **Visual Elements:** Markers, data labels, annotations, legends, gradients
36- **Advanced Features:** Technical indicators, trend lines, strip lines, multiple panes
37- **Accessibility:** Full ARIA support, keyboard navigation, localization, RTL
38- **Customization:** Themes, responsive design, print support, adaptive layout
39
40## Documentation and Navigation Guide
41
42### Complete API Reference
43
44📄 **Read:** [references/api-reference.md](references/api-reference.md)
45
46**CRITICAL: Use this reference FIRST for all API-related questions**
47
48Use this authoritative API reference when:
49- Looking up correct enum values (ChartSeriesType, ValueType, SelectionMode, etc.)
50- Finding public method signatures (RefreshAsync, ExportAsync, ShowTooltip, etc.)
51- Verifying property names and types
52- Generating code samples
53- Troubleshooting API-related issues
54
55Topics covered:
56- Complete list of SfChart public methods with signatures
57- All chart enumerations with correct values
58- Key component classes and their properties
59- Method usage examples
60- Common patterns and best practices
61
62**Key Points:**
63- All enum values are **exact** - do not use variations
64- Method names follow C# conventions (e.g., `RefreshAsync` not `Refresh`)
65- Always use `@ref` to access chart instance for method calls
66- Namespace: `Syncfusion.Blazor.Charts`
67
68---
69
70### Getting Started
71
72📄 **Read:** [references/getting-started.md](references/getting-started.md)
73
74Use this when:
75- Setting up a new Blazor Chart project
76- Installing NuGet packages and configuring services
77- Creating your first chart component
78- Understanding basic chart structure and data binding
79- Working with Visual Studio, VS Code, or .NET CLI
80
81Topics covered:
82- Installation and prerequisites
83- Package setup (Syncfusion.Blazor.Charts)
84- Namespace imports and service registration
85- Script references
86- Basic chart implementation
87- Simple data binding example
88
89---
90
91### Chart Types
92
93#### Common Chart Types
94
95📄 **Read:** [references/chart-types-common.md](references/chart-types-common.md)
96
97Use this for frequently-used chart types:
98- Line charts for trend visualization
99- Area charts for showing magnitude over time
100- Column charts for categorical comparisons
101- Bar charts for horizontal comparisons
102- Spline charts for smooth curves
103- Step charts for stepped data progression
104
105Topics covered:
106- Line, Area, Column, Bar chart implementations
107- Spline and Spline Area variations
108- Step Line and Step Area patterns
109- When to use each chart type
110- Configuration and customization
111- Multi-series examples
112
113#### Specialized Chart Types
114
115📄 **Read:** [references/chart-types-specialized.md](references/chart-types-specialized.md)
116
117Use this for specialized visualization needs:
118- Financial charts (Candle, HILO, HILOOC)
119- Statistical charts (Box-Whisker, Histogram, Error Bar, Pareto, Waterfall)
120- Stacked charts (Stack Area/Bar/Column/Line)
121- Range charts (Range Area/Column/Step Area)
122- Polar and Radar charts
123- Scatter and Bubble charts
124- Vertical chart orientation
125
126Topics covered:
127- Financial chart patterns and configurations
128- Statistical analysis chart types
129- Stacking modes (normal vs 100%)
130- Range visualization techniques
131- Circular chart layouts
132- XY scatter relationships
133- Chart orientation options
134
135---
136
137### Axes and Data Configuration
138
139📄 **Read:** [references/axes-and-scales.md](references/axes-and-scales.md)
140
141Use this when:
142- Configuring axis types (category, numeric, datetime, logarithmic)
143- Customizing axis appearance and behavior
144- Formatting axis labels and values
145- Working with multiple axes
146- Setting axis ranges and intervals
147
148Topics covered:
149- Category axis for discrete data
150- Numeric axis for continuous values
151- DateTime axis for time-series data
152- Logarithmic axis for exponential data
153- Axis customization (title, range, interval)
154- Label formatting, rotation, and positioning
155- Multiple axis configuration
156- Inverse and opposed axes
157
158📄 **Read:** [references/data-handling.md](references/data-handling.md)
159
160Use this when:
161- Binding data sources to charts
162- Adding, removing, or updating data dynamically
163- Enabling data editing
164- Sorting chart data
165- Working with live or streaming data
166
167Topics covered:
168- Data source binding (List, DataManager)
169- Dynamic data operations
170- Data editing functionality
171- Chart sorting options
172- Real-time data updates
173- Data serialization patterns
174
175---
176
177### Visual Elements
178
179📄 **Read:** [references/visual-elements.md](references/visual-elements.md)
180
181Use this when:
182- Adding data markers to chart points
183- Displaying data labels on series
184- Creating custom label templates
185- Adding annotations (text, shapes, images)
186- Applying gradient fills
187
188Topics covered:
189- Data marker types and customization
190- Data label visibility and formatting
191- Label positioning strategies
192- Data label templates
193- Displaying series labels for series identification
194- Last data label highlighting
195- Chart annotations (text, shapes, images)
196- Gradient color fills
197
198📄 **Read:** [references/legend.md](references/legend.md)
199
200Use this when:
201- Enabling and configuring chart legend
202- Positioning legend (top, bottom, left, right)
203- Customizing legend appearance
204- Implementing legend click behavior
205- Creating custom legend templates
206
207Topics covered:
208- Legend visibility and positioning
209- Legend shape and text customization
210- Interactive legend (toggle series)
211- Legend pagination
212- Custom legend templates
213- Legend alignment options
214
215---
216
217### Interactive Features
218
219📄 **Read:** [references/interactive-features.md](references/interactive-features.md)
220
221Use this when:
222- Enabling tooltips with custom formatting
223- Adding crosshair or trackball for data tracking
224- Implementing point, series, or cluster selection
225- Enabling zooming and panning
226- Creating interactive user experiences
227
228Topics covered:
229- Tooltip configuration and templates
230- Crosshair and trackball features
231- Selection modes and patterns
232- Zoom types (selection, pinch, mousewheel)
233- Zoom toolbar configuration
234- Pan functionality
235- User interaction events
236
237---
238
239### Customization and Appearance
240
241📄 **Read:** [references/appearance-styling.md](references/appearance-styling.md)
242
243Use this when:
244- Customizing chart appearance and themes
245- Setting chart dimensions and sizing
246- Configuring responsive/adaptive layout
247- Enabling print functionality
248- Styling background, borders, and margins
249
250Topics covered:
251- Chart appearance customization
252- Theme configuration
253- Chart dimensions and sizing
254- Responsive design patterns
255- Adaptive layout for mobile
256- Print support
257- Background and border styling
258- Gradient customization
259
260📄 **Read:** [references/advanced-features.md](references/advanced-features.md)
261
262Use this when:
263- Adding technical indicators (EMA, SMA, RSI, etc.)
264- Implementing trend lines (linear, exponential, polynomial)
265- Creating strip lines (horizontal/vertical bands)
266- Using multiple panes (sub-charts)
267- Handling empty points
268
269Topics covered:
270- Technical indicators for financial charts
271- Trend line types and configuration
272- Strip line patterns
273- Multiple pane layouts
274- Empty point handling strategies
275- Row and column definitions
276
277---
278
279### Accessibility and Internationalization
280
281📄 **Read:** [references/accessibility-internationalization.md](references/accessibility-internationalization.md)
282
283Use this when:
284- Implementing accessible charts (ARIA, keyboard nav)
285- Configuring advanced accessibility features
286- Enabling internationalization (i18n)
287- Setting up localization (l10n)
288- Supporting RTL layouts
289
290Topics covered:
291- Accessibility features and ARIA support
292- Keyboard navigation patterns
293- Advanced accessibility configuration
294- Internationalization setup
295- Localization resources
296- RTL support
297- Screen reader compatibility
298
299---
300
301### Events
302
303📄 **Read:** [references/events.md](references/events.md)
304
305Use this when:
306- Handling chart lifecycle events
307- Responding to user interactions (clicks, mouse events)
308- Listening to axis, series, or point events
309- Implementing custom event handlers
310- Triggering actions on zoom, pan, or selection
311
312Topics covered:
313- Chart load and render events
314- Point and series events
315- Mouse events (click, move, leave)
316- Axis label render events
317- Legend events
318- Zoom and pan events
319- Selection events
320- Event handler patterns
321
322---
323
324### Practical Examples and How-To Guides
325
326📄 **Read:** [references/practical-examples.md](references/practical-examples.md)
327
328Use this for common implementation scenarios:
329- Adding/removing series dynamically
330- Hiding axes programmatically
331- Converting milliseconds to datetime
332- Updating points dynamically
333- Implementing lazy loading
334- Creating live/real-time charts
335- Getting selected data
336- Synchronizing multiple charts
337- Adding threshold lines
338- Custom tooltip tables
339
340Topics covered:
341- Dynamic series management
342- Axis visibility control
343- Date conversion techniques
344- Dynamic point updates
345- Lazy loading patterns
346- Live chart implementation
347- Selection data retrieval
348- Chart synchronization
349- Threshold line implementation
350- Custom tooltip tables
351
352---
353
354## Public Methods Reference
355
356The `SfChart` component provides several public methods for programmatic control. Always use `@ref` to access these methods:
357
358### Essential Methods
359
360```razor
361<SfChart @ref="ChartRef">
362 <!-- Configuration -->
363</SfChart>
364
365@code {
366 SfChart ChartRef;
367
368 // Refresh the chart
369 async Task RefreshChart() => await ChartRef.RefreshAsync();
370
371 // Export the chart
372 async Task ExportChart() => await ChartRef.ExportAsync(ExportType.PNG, "chart.png");
373
374 // Print the chart
375 async Task PrintChart() => await ChartRef.PrintAsync();
376
377 // Show/Hide tooltip
378 void ShowChartTooltip() => ChartRef.ShowTooltip("January", 35);
379 void HideChartTooltip() => ChartRef.HideTooltip();
380
381 // Show/Hide crosshair
382 void ShowChartCrosshair() => ChartRef.ShowCrosshair(100, 50);
383 void HideChartCrosshair() => ChartRef.HideCrosshair();
384
385 // Selection control
386 void ClearSelections() => ChartRef.ClearSelection();
387
388 // Sorting
389 void SortData() => ChartRef.Sort("YValue", ListSortDirection.Descending);
390 void ClearChartSort() => ChartRef.ClearSort();
391}
392```
393
394**See [references/api-reference.md](references/api-reference.md) for complete method documentation.**
395
396---
397
398## ⚠️ CRITICAL: API Usage Guidelines
399
400### 1. Enum Names - MUST Use Full Namespace
401
402**Syncfusion Blazor Charts requires FULLY QUALIFIED enum names:**
403
404```razor
405<!-- ✅ CORRECT - Use full namespace -->
406<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
407<ChartSeries Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column" />
408
409<!-- ❌ WRONG - Short form will cause errors -->
410<ChartPrimaryXAxis ValueType="ValueType.Category" />
411<ChartSeries Type="ChartSeriesType.Column" />
412```
413
414**Always use `Syncfusion.Blazor.Charts.` prefix for:**
415- `ValueType` (Category, Double, DateTime, etc.)
416- `ChartSeriesType` (Column, Line, Area, etc.)
417- `LegendPosition`, `SelectionMode`, `ZoomMode`, `ChartShape`, etc.
418
419### 2. Component Property Restrictions
420
421**⚠️ Common Property Errors to Avoid:**
422
423#### ChartCrosshairLine - Limited Properties
424```razor
425<!-- ✅ CORRECT - Only Width and Color supported -->
426<ChartCrosshairSettings Enable="true">
427 <ChartCrosshairLine Width="1" Color="#666"></ChartCrosshairLine>
428</ChartCrosshairSettings>
429
430<!-- ❌ WRONG - DashArray NOT supported on ChartCrosshairLine -->
431<ChartCrosshairLine Width="1" Color="#666" DashArray="5,5"></ChartCrosshairLine>
432```
433
434**Supported ChartCrosshairLine Properties:**
435- `Width` - Line width (number)
436- `Color` - Line color (string)
437
438**NOT Supported:**
439- ❌ `DashArray` - Will cause runtime error
440- ❌ `Opacity` - Not available on this component
441
442#### Striplines - Use Plural Form
443```razor
444<!-- ✅ CORRECT - ChartStriplines (plural) -->
445<ChartPrimaryYAxis>
446 <ChartStriplines>
447 <ChartStripline Start="50" End="60" Color="red" />
448 </ChartStriplines>
449</ChartPrimaryYAxis>
450
451<!-- ❌ WRONG - ChartAxisStripLineSettings does not exist -->
452<ChartAxisStripLineSettings>
453 <ChartAxisStripLine Start="50" End="60" />
454</ChartAxisStripLineSettings>
455```
456
457### 3. Validation Checklist
458
459Before deploying, verify:
460- ✅ All enums use `Syncfusion.Blazor.Charts.` prefix
461- ✅ ChartCrosshairLine uses ONLY Width and Color
462- ✅ Striplines use `<ChartStriplines>` and `<ChartStripline>`
463- ✅ Component references use `@ref` for method access
464- ✅ Property names match official API exactly (case-sensitive)
465
466---
467
468## Quick Start Example
469
470Here's a minimal example to create a column chart with data:
471
472```razor
473@page "/chart-demo"
474@using Syncfusion.Blazor.Charts
475
476<SfChart Title="Sales Analysis">
477 <ChartPrimaryXAxis Title="Month" ValueType="Syncfusion.Blazor.Charts.ValueType.Category">
478 </ChartPrimaryXAxis>
479
480 <ChartPrimaryYAxis Title="Sales in Dollar">
481 </ChartPrimaryYAxis>
482
483 <ChartTooltipSettings Enable="true"></ChartTooltipSettings>
484
485 <ChartSeriesCollection>
486 <ChartSeries DataSource="@SalesData"
487 Name="Sales"
488 XName="Month"
489 YName="SalesValue"
490 Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
491 <ChartMarker>
492 <ChartDataLabel Visible="true"></ChartDataLabel>
493 </ChartMarker>
494 </ChartSeries>
495 </ChartSeriesCollection>
496</SfChart>
497
498@code {
499 public class SalesInfo
500 {
501 public string Month { get; set; }
502 public double SalesValue { get; set; }
503 }
504
505 public List<SalesInfo> SalesData = new List<SalesInfo>
506 {
507 new SalesInfo { Month = "Jan", SalesValue = 35 },
508 new SalesInfo { Month = "Feb", SalesValue = 28 },
509 new SalesInfo { Month = "Mar", SalesValue = 34 },
510 new SalesInfo { Month = "Apr", SalesValue = 32 },
511 new SalesInfo { Month = "May", SalesValue = 40 },
512 new SalesInfo { Month = "Jun", SalesValue = 32 }
513 };
514}
515```
516
517**Prerequisites:**
5181. Install `Syncfusion.Blazor.Charts` NuGet package
5192. Add `@using Syncfusion.Blazor.Charts` to `_Imports.razor`
5203. Register service: `builder.Services.AddSyncfusionBlazor();` in `Program.cs`
5214. Add script reference in `App.razor`
522
523---
524
525## Common Patterns
526
527### Multi-Series Comparison Chart
528
529```razor
530<SfChart Title="Product Sales Comparison">
531 <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
532
533 <ChartSeriesCollection>
534 <ChartSeries DataSource="@Product1Sales" XName="Month" YName="Sales"
535 Name="Product 1" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
536 </ChartSeries>
537 <ChartSeries DataSource="@Product2Sales" XName="Month" YName="Sales"
538 Name="Product 2" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
539 </ChartSeries>
540 </ChartSeriesCollection>
541
542 <ChartLegendSettings Visible="true"></ChartLegendSettings>
543</SfChart>
544```
545
546### Time-Series Line Chart with Zooming
547
548```razor
549<SfChart>
550 <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime"
551 Title="Date">
552 </ChartPrimaryXAxis>
553
554 <ChartZoomSettings EnableSelectionZooming="true"
555 EnablePan="true"
556 EnableMouseWheelZooming="true">
557 </ChartZoomSettings>
558
559 <ChartSeriesCollection>
560 <ChartSeries DataSource="@TimeSeriesData"
561 XName="Date"
562 YName="Value"
563 Type="Syncfusion.Blazor.Charts.ChartSeriesType.Line">
564 </ChartSeries>
565 </ChartSeriesCollection>
566</SfChart>
567```
568
569### Stacked Area Chart with Legend
570
571```razor
572<SfChart Title="Resource Allocation">
573 <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
574
575 <ChartSeriesCollection>
576 <ChartSeries DataSource="@ResourceData1" XName="Period" YName="Hours"
577 Name="Development" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
578 </ChartSeries>
579 <ChartSeries DataSource="@ResourceData2" XName="Period" YName="Hours"
580 Name="Testing" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
581 </ChartSeries>
582 <ChartSeries DataSource="@ResourceData3" XName="Period" YName="Hours"
583 Name="Documentation" Type="Syncfusion.Blazor.Charts.ChartSeriesType.StackingArea">
584 </ChartSeries>
585 </ChartSeriesCollection>
586
587 <ChartLegendSettings Visible="true" Position="Syncfusion.Blazor.Charts.LegendPosition.Bottom">
588 </ChartLegendSettings>
589</SfChart>
590```
591
592---
593
594## Key Configuration Properties
595
596### Chart Component (`SfChart`)
597- `Title` - Chart title text
598- `Width` / `Height` - Chart dimensions (accepts px or %, default: "100%")
599- `Theme` - Visual theme (see Theme enum in API reference)
600- `Background` - Chart background color
601- `EnableAnimation` - Enable/disable animation (default: true)
602- `SelectionMode` - Selection mode (None, Series, Point, Cluster, DragXY, DragX, DragY, Lasso)
603- `HighlightMode` - Highlight mode (None, Series, Point, Cluster)
604
605### Primary Axes (`ChartPrimaryXAxis`, `ChartPrimaryYAxis`)
606- `ValueType` - Axis type: `Syncfusion.Blazor.Charts.ValueType.Category`, `ValueType.Double`, `ValueType.DateTime`, `ValueType.Logarithmic`, `ValueType.DateTimeCategory`
607- `Title` - Axis title
608- `Minimum` / `Maximum` - Axis range
609- `Interval` - Spacing between labels
610- `LabelFormat` - Format string for labels (e.g., "C0", "N2", "dd MMM")
611- `EdgeLabelPlacement` - Edge label handling (None, Hide, Shift)
612- `LabelIntersectAction` - Label intersection handling (None, Hide, Trim, Wrap, MultipleRows, Rotate45, Rotate90)
613- **Striplines** - Use `<ChartStriplines>` (plural) for horizontal/vertical bands
614
615### Series (`ChartSeries`)
616- `DataSource` - Data collection (IEnumerable<object>)
617- `XName` / `YName` - Property names for X and Y values (case-sensitive)
618- `Type` - Chart type: `Syncfusion.Blazor.Charts.ChartSeriesType.Column`, `ChartSeriesType.Line`, etc. (see API reference)
619- `Name` - Series name for legend
620- `Fill` - Series color (CSS color string)
621- `Width` - Line/border width (pixels)
622- `DashArray` - Dash pattern (e.g., "5,5")
623- `Opacity` - Transparency (0 to 1)
624
625### Interactivity
626- `ChartTooltipSettings` - Tooltip configuration
627 - `Enable` - Show/hide tooltip
628 - `Shared` - Enable shared tooltip for multiple series
629 - `Format` - Custom tooltip format
630 - `Template` - Custom tooltip template (RenderFragment)
631- `ChartZoomSettings` - Zoom and pan options
632 - `EnableSelectionZooming` - Enable selection-based zoom
633 - `EnableMouseWheelZooming` - Enable mouse wheel zoom
634 - `EnablePinchZooming` - Enable pinch zoom (touch devices)
635 - `EnablePan` - Enable panning
636 - `Mode` - Zoom mode (X, Y, XY)
637- `SelectionMode` - Selection behavior (see SelectionMode enum)
638- `ChartCrosshairSettings` - Crosshair configuration
639 - `Enable` - Show/hide crosshair
640 - `LineType` - Crosshair line type (Vertical, Horizontal, Both)
641 - `ChartCrosshairLine` - Line style (Width, Color ONLY - NO DashArray)
642
643### Visual Elements
644- `ChartMarker` - Data point markers
645 - `Visible` - Show/hide markers
646 - `Shape` - Marker shape (see ChartShape enum)
647 - `Width` / `Height` - Marker dimensions
648- `ChartDataLabel` - Data labels on points
649 - `Visible` - Show/hide labels
650 - `Position` - Label position
651 - `Template` - Custom label template
652- `SeriesLabelSettings` - Series label visibility, text, overlap handling, and styling
653- `ChartLegendSettings` - Legend configuration
654 - `Visible` - Show/hide legend
655 - `Position` - Legend position (see LegendPosition enum)
656- `ChartAnnotations` - Custom annotations
657 - Support for text, images, and shapes
658
659---
660
661## Additional Resources
662
663- **Official Documentation:** [Syncfusion Blazor Chart Documentation](https://blazor.syncfusion.com/documentation/chart/getting-started)
664- **API Reference:** [Chart API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.html)
665- **Live Demos:** [Blazor Chart Demos](https://blazor.syncfusion.com/demos/chart/line)