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