Implementing Syncfusion .NET MAUI Spark Charts
When to Use This Skill
Use this skill when implementing the SfSparkChart control in .NET MAUI applications. Spark Charts are lightweight, micro-visualization controls ideal for displaying data trends in compact spaces like dashboards, grids, and reports.
Key Scenarios:
- Displaying quick data trends without consuming significant UI space
- Visualizing sales trends, stock performance, or time-series data
- Showing positive/negative values in Win/Loss scenarios
- Creating dashboard components with multiple micro-charts
- Highlighting specific data points (first, last, high, low, negative values)
Component Overview
The SfSparkChart is a compact charting control with four built-in chart types:
| Chart Type |
Use Case |
Best For |
| SparkLineChart |
Line-based visualization |
Identifying trends and patterns |
| SparkAreaChart |
Filled area visualization |
Emphasizing magnitude of change |
| SparkColumnChart |
Vertical bar visualization |
Comparing different data values |
| SparkWinLossChart |
Win/Loss representation |
Showing positive/negative scenarios |
Core Features:
- Data binding to ObservableCollection, List, or IEnumerable
- Four chart types for different visualization needs
- Marker display and customization (Line/Area charts only)
- Data point styling (first, last, high, low, negative)
- Axis display and origin customization
- Range band highlighting for value regions
- Lightweight and performance-optimized for micro-visualizations
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and NuGet package setup
- Project configuration (MauiProgram.cs handler registration)
- Basic SparkLineChart implementation
- Namespace imports and first render
- Data binding setup
- Copy-paste-ready starter code
Chart Types
📄 Read: references/chart-types.md
- Choosing the right chart type for your data
- SparkLineChart: Line-based trend visualization
- SparkAreaChart: Filled area representation
- SparkColumnChart: Vertical bar comparison
- SparkWinLossChart: Win/Loss scenarios
- When to use each type with code examples
- Common type selection patterns
Markers and Labels
📄 Read: references/markers-and-labels.md
- Enabling markers on Line and Area charts
- Marker shape types and customization
- Marker styling properties (Fill, Stroke, StrokeWidth, Height, Width)
- Marker positioning and visibility
- Common marker patterns (highlighting endpoints, data points)
- Performance considerations for marker display
Styling and Appearance
📄 Read: references/styling-and-appearance.md
- Data point styling and color customization
- First, last, high, and low point highlighting
- Negative value styling for Column and WinLoss charts
- Brush and color properties
- Padding and spacing configuration
- Size customization and layout control
- Advanced styling examples
Data Binding
📄 Read: references/data-binding.md
- Binding to ObservableCollection for reactive updates
- Binding to List for static data
- Binding to IEnumerable for LINQ queries
- XBindingPath and YBindingPath configuration
- Dynamic data source updates
- Common binding patterns and best practices
Axis and Ranges
📄 Read: references/axis-and-ranges.md
- Enabling axis display (ShowAxis property)
- Axis origin configuration for baseline reference
- Axis types (Numeric, Category, DateTime)
- XBindingPath property for category/time-based axes
- Range band visualization (RangeBandStart, RangeBandEnd, RangeBandFill)
- Axis line styling and customization
- Highlighting value regions and thresholds
Quick Start Example
// Step 1: Configure handler in MauiProgram.cs
using Syncfusion.Maui.Toolkit.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureSyncfusionToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
return builder.Build();
}
}
// Step 2: Create basic SparkLineChart in XAML
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:sparkchart="clr-namespace:Syncfusion.Maui.Toolkit.SparkCharts;assembly=Syncfusion.Maui.Toolkit"
x:Class="SparkChartDemo.MainPage">
<sparkchart:SfSparkLineChart
ItemsSource="{Binding Data}"
YBindingPath="Value"
ShowMarkers="True"
HeightRequest="100"
WidthRequest="150">
</sparkchart:SfSparkLineChart>
</ContentPage>
// Step 3: Bind data from ViewModel
public class SparkDataViewModel
{
public ObservableCollection<DataPoint> Data { get; set; }
public SparkDataViewModel()
{
Data = new ObservableCollection<DataPoint>
{
new DataPoint { Value = 10 },
new DataPoint { Value = 15 },
new DataPoint { Value = 12 },
new DataPoint { Value = 20 },
new DataPoint { Value = 18 }
};
}
}
public class DataPoint
{
public double Value { get; set; }
}
Common Patterns
Pattern 1: Dashboard Summary Card
// Show quick sales trend in a card
<sparkchart:SfSparkLineChart
ItemsSource="{Binding MonthlySales}"
YBindingPath="Amount"
ShowMarkers="False"
FirstPointFill="Blue"
LastPointFill="Red">
</sparkchart:SfSparkLineChart>
Pattern 2: Performance Indicator with Threshold
// Highlight data within acceptable range using RangeBand
<sparkchart:SfSparkLineChart
ItemsSource="{Binding PerformanceMetrics}"
YBindingPath="Value"
ShowAxis="True"
RangeBandStart="50"
RangeBandEnd="100"
RangeBandFill="LightGreen">
</sparkchart:SfSparkLineChart>
Pattern 3: Win/Loss Visualization
// Show positive and negative outcomes
<sparkchart:SfSparkWinLossChart
ItemsSource="{Binding GameResults}"
YBindingPath="Result"
NegativePointsFill="Red">
</sparkchart:SfSparkWinLossChart>
Pattern 4: Styled Data Points
// Emphasize critical data points
<sparkchart:SfSparkColumnChart
ItemsSource="{Binding MonthlyRevenue}"
YBindingPath="Revenue"
FirstPointFill="Green"
LastPointFill="Blue"
HighPointFill="Gold"
LowPointFill="Red"
NegativePointsFill="DarkRed">
</sparkchart:SfSparkColumnChart>
Key Props Reference
Core Properties
| Property |
Type |
Default |
Purpose |
ItemsSource |
IEnumerable |
- |
Data source for chart |
YBindingPath |
string |
- |
Property name for Y-axis values |
XBindingPath |
string |
- |
Property name for X-axis values |
Height |
double |
- |
Chart height in pixels |
Width |
double |
- |
Chart width in pixels |
Display Properties
| Property |
Type |
Default |
Purpose |
ShowMarkers |
bool |
false |
Display markers (Line/Area only) |
ShowAxis |
bool |
false |
Display axis baseline |
Padding |
Thickness |
0 |
Space around chart content |
AxisOrigin |
double |
- |
Y-axis value for axis line position |
Styling Properties
| Property |
Type |
Default |
Purpose |
FirstPointFill |
Brush |
- |
Color of first data point |
LastPointFill |
Brush |
- |
Color of last data point |
HighPointFill |
Brush |
- |
Color of highest data point |
LowPointFill |
Brush |
- |
Color of lowest data point |
NegativePointsFill |
Brush |
- |
Color of negative values (Column/WinLoss) |
Range Band Properties
| Property |
Type |
Default |
Purpose |
RangeBandStart |
double |
- |
Y-axis start value for range band |
RangeBandEnd |
double |
- |
Y-axis end value for range band |
RangeBandFill |
Brush |
- |
Color for range band region |
Axis Properties
| Property |
Type |
Default |
Purpose |
AxisType |
SparkChartAxisType |
Numeric |
Axis scale type (Numeric, Category, DateTime) |
AxisLineStyle |
SparkChartLineStyle |
- |
Axis appearance (Stroke, StrokeWidth, StrokeDashArray) |
Marker Properties (Line/Area Only)
| Property |
Type |
Default |
Purpose |
MarkerSettings |
SparkChartMarkerSettings |
- |
Marker customization configuration |
Common Challenges & Solutions
Issue: Chart appears empty
Causes: Missing ItemsSource binding, incorrect YBindingPath, data source is null
Solutions:
- Verify ItemsSource is properly bound to a populated collection
- Confirm YBindingPath matches your data property name exactly
- Check that data property is public and contains numeric values
Issue: Markers not showing
Note: Markers only work on Line and Area charts
Solutions:
- Verify you're using SfSparkLineChart or SfSparkAreaChart
- Set ShowMarkers="True" in XAML or code
- Check MarkerSettings are not hiding markers (verify Height/Width > 0)
Issue: Range band not visible
Solutions:
- Verify RangeBandStart < RangeBandEnd
- Ensure range values are within your data's Y-axis range
- Check RangeBandFill is not transparent
Issue: Poor performance with large datasets
Solutions:
- Consider displaying only recent data points
- Use aggregated data instead of raw values
- Avoid excessive marker styling on large datasets
- Disable ShowMarkers for performance-critical scenarios
Next Steps
- Ready to implement? → Start with Getting Started
- Need specific features? → Browse Chart Types, Markers, or Styling
- Complex scenarios? → Check Data Binding and Axis Configuration
1---
2name: syncfusion-maui-toolkit-spark-charts
3description: Use this skill ALWAYS when the user needs to implement Syncfusion MAUI Spark Charts. Triggers on spark chart, sparkline, micro-chart, trend visualization, data visualization in small spaces, chart types (line, area, column, win/loss), markers, range bands, axis configuration, data point styling. Also use immediately for chart customization, performance optimization, marker configuration, data binding patterns, accessibility needs.
4metadata:
5 author: "Syncfusion Inc"
6 version: "1.0.0"
7---
8
9# Implementing Syncfusion .NET MAUI Spark Charts
10
11## When to Use This Skill
12
13Use this skill when implementing the **SfSparkChart** control in .NET MAUI applications. Spark Charts are lightweight, micro-visualization controls ideal for displaying data trends in compact spaces like dashboards, grids, and reports.
14
15**Key Scenarios:**
16- Displaying quick data trends without consuming significant UI space
17- Visualizing sales trends, stock performance, or time-series data
18- Showing positive/negative values in Win/Loss scenarios
19- Creating dashboard components with multiple micro-charts
20- Highlighting specific data points (first, last, high, low, negative values)
21
22---
23
24## Component Overview
25
26The **SfSparkChart** is a compact charting control with four built-in chart types:
27
28| Chart Type | Use Case | Best For |
29|-----------|----------|----------|
30| **SparkLineChart** | Line-based visualization | Identifying trends and patterns |
31| **SparkAreaChart** | Filled area visualization | Emphasizing magnitude of change |
32| **SparkColumnChart** | Vertical bar visualization | Comparing different data values |
33| **SparkWinLossChart** | Win/Loss representation | Showing positive/negative scenarios |
34
35**Core Features:**
36- Data binding to ObservableCollection, List, or IEnumerable
37- Four chart types for different visualization needs
38- Marker display and customization (Line/Area charts only)
39- Data point styling (first, last, high, low, negative)
40- Axis display and origin customization
41- Range band highlighting for value regions
42- Lightweight and performance-optimized for micro-visualizations
43
44---
45
46## Documentation and Navigation Guide
47
48### Getting Started
49📄 **Read:** [references/getting-started.md](references/getting-started.md)
50- Installation and NuGet package setup
51- Project configuration (MauiProgram.cs handler registration)
52- Basic SparkLineChart implementation
53- Namespace imports and first render
54- Data binding setup
55- Copy-paste-ready starter code
56
57### Chart Types
58📄 **Read:** [references/chart-types.md](references/chart-types.md)
59- Choosing the right chart type for your data
60- SparkLineChart: Line-based trend visualization
61- SparkAreaChart: Filled area representation
62- SparkColumnChart: Vertical bar comparison
63- SparkWinLossChart: Win/Loss scenarios
64- When to use each type with code examples
65- Common type selection patterns
66
67### Markers and Labels
68📄 **Read:** [references/markers-and-labels.md](references/markers-and-labels.md)
69- Enabling markers on Line and Area charts
70- Marker shape types and customization
71- Marker styling properties (Fill, Stroke, StrokeWidth, Height, Width)
72- Marker positioning and visibility
73- Common marker patterns (highlighting endpoints, data points)
74- Performance considerations for marker display
75
76### Styling and Appearance
77📄 **Read:** [references/styling-and-appearance.md](references/styling-and-appearance.md)
78- Data point styling and color customization
79- First, last, high, and low point highlighting
80- Negative value styling for Column and WinLoss charts
81- Brush and color properties
82- Padding and spacing configuration
83- Size customization and layout control
84- Advanced styling examples
85
86### Data Binding
87📄 **Read:** [references/data-binding.md](references/data-binding.md)
88- Binding to ObservableCollection for reactive updates
89- Binding to List<T> for static data
90- Binding to IEnumerable for LINQ queries
91- XBindingPath and YBindingPath configuration
92- Dynamic data source updates
93- Common binding patterns and best practices
94
95### Axis and Ranges
96📄 **Read:** [references/axis-and-ranges.md](references/axis-and-ranges.md)
97- Enabling axis display (ShowAxis property)
98- Axis origin configuration for baseline reference
99- Axis types (Numeric, Category, DateTime)
100- XBindingPath property for category/time-based axes
101- Range band visualization (RangeBandStart, RangeBandEnd, RangeBandFill)
102- Axis line styling and customization
103- Highlighting value regions and thresholds
104
105---
106
107## Quick Start Example
108
109```csharp
110// Step 1: Configure handler in MauiProgram.cs
111using Syncfusion.Maui.Toolkit.Hosting;
112
113public static class MauiProgram
114{
115 public static MauiApp CreateMauiApp()
116 {
117 var builder = MauiApp.CreateBuilder();
118 builder
119 .UseMauiApp<App>()
120 .ConfigureSyncfusionToolkit()
121 .ConfigureFonts(fonts =>
122 {
123 fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
124 });
125 return builder.Build();
126 }
127}
128
129// Step 2: Create basic SparkLineChart in XAML
130<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
131 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
132 xmlns:sparkchart="clr-namespace:Syncfusion.Maui.Toolkit.SparkCharts;assembly=Syncfusion.Maui.Toolkit"
133 x:Class="SparkChartDemo.MainPage">
134
135 <sparkchart:SfSparkLineChart
136 ItemsSource="{Binding Data}"
137 YBindingPath="Value"
138 ShowMarkers="True"
139 HeightRequest="100"
140 WidthRequest="150">
141 </sparkchart:SfSparkLineChart>
142
143</ContentPage>
144
145// Step 3: Bind data from ViewModel
146public class SparkDataViewModel
147{
148 public ObservableCollection<DataPoint> Data { get; set; }
149
150 public SparkDataViewModel()
151 {
152 Data = new ObservableCollection<DataPoint>
153 {
154 new DataPoint { Value = 10 },
155 new DataPoint { Value = 15 },
156 new DataPoint { Value = 12 },
157 new DataPoint { Value = 20 },
158 new DataPoint { Value = 18 }
159 };
160 }
161}
162
163public class DataPoint
164{
165 public double Value { get; set; }
166}
167```
168
169---
170
171## Common Patterns
172
173### Pattern 1: Dashboard Summary Card
174```csharp
175// Show quick sales trend in a card
176<sparkchart:SfSparkLineChart
177 ItemsSource="{Binding MonthlySales}"
178 YBindingPath="Amount"
179 ShowMarkers="False"
180 FirstPointFill="Blue"
181 LastPointFill="Red">
182</sparkchart:SfSparkLineChart>
183```
184
185### Pattern 2: Performance Indicator with Threshold
186```csharp
187// Highlight data within acceptable range using RangeBand
188<sparkchart:SfSparkLineChart
189 ItemsSource="{Binding PerformanceMetrics}"
190 YBindingPath="Value"
191 ShowAxis="True"
192 RangeBandStart="50"
193 RangeBandEnd="100"
194 RangeBandFill="LightGreen">
195</sparkchart:SfSparkLineChart>
196```
197
198### Pattern 3: Win/Loss Visualization
199```csharp
200// Show positive and negative outcomes
201<sparkchart:SfSparkWinLossChart
202 ItemsSource="{Binding GameResults}"
203 YBindingPath="Result"
204 NegativePointsFill="Red">
205</sparkchart:SfSparkWinLossChart>
206```
207
208### Pattern 4: Styled Data Points
209```csharp
210// Emphasize critical data points
211<sparkchart:SfSparkColumnChart
212 ItemsSource="{Binding MonthlyRevenue}"
213 YBindingPath="Revenue"
214 FirstPointFill="Green"
215 LastPointFill="Blue"
216 HighPointFill="Gold"
217 LowPointFill="Red"
218 NegativePointsFill="DarkRed">
219</sparkchart:SfSparkColumnChart>
220```
221
222---
223
224## Key Props Reference
225
226### Core Properties
227| Property | Type | Default | Purpose |
228|----------|------|---------|---------|
229| `ItemsSource` | IEnumerable | - | Data source for chart |
230| `YBindingPath` | string | - | Property name for Y-axis values |
231| `XBindingPath` | string | - | Property name for X-axis values |
232| `Height` | double | - | Chart height in pixels |
233| `Width` | double | - | Chart width in pixels |
234
235### Display Properties
236| Property | Type | Default | Purpose |
237|----------|------|---------|---------|
238| `ShowMarkers` | bool | false | Display markers (Line/Area only) |
239| `ShowAxis` | bool | false | Display axis baseline |
240| `Padding` | Thickness | 0 | Space around chart content |
241| `AxisOrigin` | double | - | Y-axis value for axis line position |
242
243### Styling Properties
244| Property | Type | Default | Purpose |
245|----------|------|---------|---------|
246| `FirstPointFill` | Brush | - | Color of first data point |
247| `LastPointFill` | Brush | - | Color of last data point |
248| `HighPointFill` | Brush | - | Color of highest data point |
249| `LowPointFill` | Brush | - | Color of lowest data point |
250| `NegativePointsFill` | Brush | - | Color of negative values (Column/WinLoss) |
251
252### Range Band Properties
253| Property | Type | Default | Purpose |
254|----------|------|---------|---------|
255| `RangeBandStart` | double | - | Y-axis start value for range band |
256| `RangeBandEnd` | double | - | Y-axis end value for range band |
257| `RangeBandFill` | Brush | - | Color for range band region |
258
259### Axis Properties
260| Property | Type | Default | Purpose |
261|----------|------|---------|---------|
262| `AxisType` | SparkChartAxisType | Numeric | Axis scale type (Numeric, Category, DateTime) |
263| `AxisLineStyle` | SparkChartLineStyle | - | Axis appearance (Stroke, StrokeWidth, StrokeDashArray) |
264
265### Marker Properties (Line/Area Only)
266| Property | Type | Default | Purpose |
267|----------|------|---------|---------|
268| `MarkerSettings` | SparkChartMarkerSettings | - | Marker customization configuration |
269
270---
271
272## Common Challenges & Solutions
273
274### Issue: Chart appears empty
275**Causes:** Missing ItemsSource binding, incorrect YBindingPath, data source is null
276**Solutions:**
2771. Verify ItemsSource is properly bound to a populated collection
2782. Confirm YBindingPath matches your data property name exactly
2793. Check that data property is public and contains numeric values
280
281### Issue: Markers not showing
282**Note:** Markers only work on Line and Area charts
283**Solutions:**
2841. Verify you're using SfSparkLineChart or SfSparkAreaChart
2852. Set ShowMarkers="True" in XAML or code
2863. Check MarkerSettings are not hiding markers (verify Height/Width > 0)
287
288### Issue: Range band not visible
289**Solutions:**
2901. Verify RangeBandStart < RangeBandEnd
2912. Ensure range values are within your data's Y-axis range
2923. Check RangeBandFill is not transparent
293
294### Issue: Poor performance with large datasets
295**Solutions:**
2961. Consider displaying only recent data points
2972. Use aggregated data instead of raw values
2983. Avoid excessive marker styling on large datasets
2994. Disable ShowMarkers for performance-critical scenarios
300
301---
302
303## Next Steps
304
305- **Ready to implement?** → Start with [Getting Started](references/getting-started.md)
306- **Need specific features?** → Browse [Chart Types](references/chart-types.md), [Markers](references/markers-and-labels.md), or [Styling](references/styling-and-appearance.md)
307- **Complex scenarios?** → Check [Data Binding](references/data-binding.md) and [Axis Configuration](references/axis-and-ranges.md)