Implementing Syncfusion Flutter Cartesian Charts
SfCartesianChart is a high-performance Flutter widget from the syncfusion_flutter_charts package that supports 30+ chart types plotted on Cartesian (X/Y) coordinates. It handles real-time data, rich interactivity, and deep customization.
When to Use This Skill
Use this skill when you need to:
- Render any line, area, column, bar, spline, scatter, or financial chart in Flutter
- Configure axis types (numeric, category, date-time, logarithmic)
- Add zooming, panning, tooltip, trackball, or crosshair interaction
- Customize series appearance (colors, gradients, markers, data labels)
- Add annotations, technical indicators, or trendlines
- Export charts or respond to chart callbacks
- Support RTL, localization, or accessibility
Component Overview
The SfCartesianChart widget is a comprehensive charting solution that displays data using Cartesian (X/Y) coordinates. It supports over 30 chart types across multiple categories:
- Line Charts: Line, fast line, spline (various tension types), step line
- Area Charts: Area, spline area, step area, range area, spline range area, stacked area (including 100%)
- Column/Bar Charts: Column, bar, range column, stacked column/bar (including 100%)
- Scatter/Bubble: Scatter, bubble charts
- Financial Charts: Candle, OHLC, HiLo, HiLoOpenClose with support for technical indicators
- Statistical: Histogram, box and whisker, error bar
- Waterfall: For cumulative effect visualization
The widget provides five axis types (Numeric, Category, DateTime, DateTimeCategory, Logarithmic), interactive features (zoom, pan, tooltip, trackball, crosshair), selection behaviors, rich customization (markers, data labels, gradients, animations), technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands, etc.), trendlines, annotations, and chart export capabilities.
Quick Start
# Always installs the latest compatible version automatically
flutter pub add syncfusion_flutter_charts
Always install the package via terminal — do not edit pubspec.yaml directly.
Run this command from the Flutter project root and wait for it to complete successfully before proceeding.
import 'package:syncfusion_flutter_charts/charts.dart';
class MyChart extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 300,
child: SfCartesianChart(
primaryXAxis: CategoryAxis(),
title: ChartTitle(text: 'Monthly Sales'),
legend: Legend(isVisible: true),
tooltipBehavior: TooltipBehavior(enable: true),
series: <CartesianSeries>[
LineSeries<ChartData, String>(
dataSource: [
ChartData('Jan', 35),
ChartData('Feb', 28),
ChartData('Mar', 34),
ChartData('Apr', 32),
ChartData('May', 40),
],
xValueMapper: (ChartData d, _) => d.x,
yValueMapper: (ChartData d, _) => d.y,
name: 'Sales',
dataLabelSettings: DataLabelSettings(isVisible: true),
),
],
),
);
}
}
class ChartData {
ChartData(this.x, this.y);
final String x;
final double? y;
}
Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Package installation and import
- Initialize SfCartesianChart
- Bind data source and data model
- Add title, data labels, legend, tooltip
- Complete minimal working example
Line, Area & Spline Chart Types
📄 Read: references/chart-types-line-area.md
- Line, fast line, spline (with spline types)
- Step line, area, spline area
- Step area, range area, spline range area
- When to use each type
Column, Bar & Other Cartesian Types
📄 Read: references/chart-types-column-bar.md
- Column, bar, range column
- Bubble, scatter, histogram
- Waterfall, error bar, box and whisker
- Key configuration for each type
Stacked Chart Types
📄 Read: references/chart-types-stacked.md
- Stacked area/bar/column/line
- 100% stacked variants
- When to choose stacked vs 100% stacked
Financial Chart Types
📄 Read: references/chart-types-financial.md
- Candle, HILO, OHLC charts
- Financial data model (open/high/low/close mappers)
- Hollow candle and solid candle
Axis Types
📄 Read: references/axis-types.md
- NumericAxis, CategoryAxis, DateTimeAxis
- DateTimeCategoryAxis, LogarithmicAxis
- Choosing the right axis for your data
Axis Customization
📄 Read: references/axis-customization.md
- Title, labels, label format
- Gridlines, tick marks, range (min/max/interval)
- Strip lines, multi-level labels
- Secondary axis, axis crossing, inversed axis
Series Customization
📄 Read: references/series-customization.md
- Color, border, opacity, gradient fill
- Dash array, width, point color mapper
- Animation, palette colors, empty point settings
Legend
📄 Read: references/legend.md
- Enable and position legend
- Toggle series visibility via legend
- Overflow modes (wrap, scroll)
- Custom legend items and icons
Tooltip, Trackball & Crosshair
📄 Read: references/tooltip-trackball.md
- TooltipBehavior — enable, format, custom template
- Shared tooltip across series
- TrackballBehavior — display modes
- CrosshairBehavior configuration
Zooming, Panning & Selection
📄 Read: references/zoom-pan-selection.md
- ZoomPanBehavior — pinch, mouse wheel, directional
- ZoomMode (x, y, xy), panning
- Auto-scrolling for live data
- SelectionBehavior — point, series, cluster, box
Annotations, Markers & Data Labels
📄 Read: references/annotations-markers-datalabels.md
- CartesianChartAnnotation — text and widget overlays
- Coordinate units (point vs pixel vs percent)
- MarkerSettings — shape, size, color
- DataLabelSettings — position, format, template, connector lines
Technical Indicators & Trendlines
📄 Read: references/technical-indicators-trendlines.md
- SMA, EMA, TMA, WMA, MACD, RSI, Stochastic
- Bollinger Bands, ATR, CCI, Momentum, AD, ROC
- Trendline types (linear, exponential, polynomial, moving average, power, logarithmic)
- Forecasting periods
Chart Appearance & Multiple Charts
📄 Read: references/chart-appearance.md
- Background color/image, plot area customization
- Color palette, theme integration
- Rendering multiple charts on the same screen
- On-demand / lazy data loading
Callbacks, Methods, Export & Accessibility
📄 Read: references/callbacks-methods-export.md
- Key callbacks (onTooltipRender, onDataLabelRender, onZooming, etc.)
- ChartSeriesController methods (updateDataSource, animate)
- Export to PNG, PDF, JPEG
- Localization, RTL, accessibility
Common Patterns
Pattern 1 — Live / Real-Time Data Update
late ChartSeriesController _controller;
onRendererCreated: (ChartSeriesController controller) {
_controller = controller;
},
void addDataPoint(ChartData newPoint) {
chartData.add(newPoint);
_controller.updateDataSource(
addedDataIndexes: [chartData.length - 1],
);
}
Pattern 2 — Multiple Series on One Chart
series: <CartesianSeries>[
LineSeries<ChartData, String>(
dataSource: data,
xValueMapper: (d, _) => d.x,
yValueMapper: (d, _) => d.y1,
name: 'Revenue',
),
ColumnSeries<ChartData, String>(
dataSource: data,
xValueMapper: (d, _) => d.x,
yValueMapper: (d, _) => d.y2,
name: 'Cost',
),
]
Pattern 3 — Zoom + Tooltip Together
late ZoomPanBehavior _zoom;
late TooltipBehavior _tooltip;
@override
void initState() {
_zoom = ZoomPanBehavior(enablePinching: true, enableDoubleTapZooming: true);
_tooltip = TooltipBehavior(enable: true);
super.initState();
}
zoomPanBehavior: _zoom,
tooltipBehavior: _tooltip,
Key Widget Properties
| Property |
Type |
Purpose |
primaryXAxis |
ChartAxis |
Horizontal axis type and config |
primaryYAxis |
ChartAxis |
Vertical axis type and config |
series |
List<CartesianSeries> |
One or more data series |
title |
ChartTitle |
Chart heading text |
legend |
Legend |
Legend visibility and position |
tooltipBehavior |
TooltipBehavior |
Tooltip on tap |
zoomPanBehavior |
ZoomPanBehavior |
Zoom and pan interaction |
selectionType |
SelectionType |
Point/series/cluster selection |
annotations |
List<CartesianChartAnnotation> |
Overlay widgets/text |
indicators |
List<TechnicalIndicator> |
Technical analysis overlays |
onTooltipRender |
ChartTooltipCallback |
Customize tooltip text |
onZooming |
ChartZoomingCallback |
Respond to zoom events |
palette |
List<Color> |
Custom series color palette |
1---2name: syncfusion-flutter-cartesian-charts3description: Implements Syncfusion Flutter Cartesian Charts (SfCartesianChart) for a wide range of 2D chart types in Flutter apps. Use when working with line, column, bar, area, spline, scatter, bubble, financial, stacked, or histogram charts. This skill covers axis types (NumericAxis, CategoryAxis, DateTimeAxis), zoom and pan, tooltip, trackball, legend, annotations, technical indicators, trendlines, and chart export.4---56# Implementing Syncfusion Flutter Cartesian Charts78`SfCartesianChart` is a high-performance Flutter widget from the `syncfusion_flutter_charts` package that supports 30+ chart types plotted on Cartesian (X/Y) coordinates. It handles real-time data, rich interactivity, and deep customization.910## When to Use This Skill1112Use this skill when you need to:13- Render any line, area, column, bar, spline, scatter, or financial chart in Flutter14- Configure axis types (numeric, category, date-time, logarithmic)15- Add zooming, panning, tooltip, trackball, or crosshair interaction16- Customize series appearance (colors, gradients, markers, data labels)17- Add annotations, technical indicators, or trendlines18- Export charts or respond to chart callbacks19- Support RTL, localization, or accessibility2021## Component Overview2223The **SfCartesianChart** widget is a comprehensive charting solution that displays data using Cartesian (X/Y) coordinates. It supports over 30 chart types across multiple categories:2425- **Line Charts**: Line, fast line, spline (various tension types), step line26- **Area Charts**: Area, spline area, step area, range area, spline range area, stacked area (including 100%)27- **Column/Bar Charts**: Column, bar, range column, stacked column/bar (including 100%)28- **Scatter/Bubble**: Scatter, bubble charts29- **Financial Charts**: Candle, OHLC, HiLo, HiLoOpenClose with support for technical indicators30- **Statistical**: Histogram, box and whisker, error bar31- **Waterfall**: For cumulative effect visualization3233The widget provides five axis types (Numeric, Category, DateTime, DateTimeCategory, Logarithmic), interactive features (zoom, pan, tooltip, trackball, crosshair), selection behaviors, rich customization (markers, data labels, gradients, animations), technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands, etc.), trendlines, annotations, and chart export capabilities.3435---3637## Quick Start3839```bash40# Always installs the latest compatible version automatically41flutter pub add syncfusion_flutter_charts42```43> Always install the package via terminal — do **not** edit `pubspec.yaml` directly.44> Run this command from the Flutter project root and wait for it to complete successfully before proceeding.4546```dart47import 'package:syncfusion_flutter_charts/charts.dart';4849class MyChart extends StatelessWidget {50 @override51 Widget build(BuildContext context) {52 return SizedBox(53 height: 300,54 child: SfCartesianChart(55 primaryXAxis: CategoryAxis(),56 title: ChartTitle(text: 'Monthly Sales'),57 legend: Legend(isVisible: true),58 tooltipBehavior: TooltipBehavior(enable: true),59 series: <CartesianSeries>[60 LineSeries<ChartData, String>(61 dataSource: [62 ChartData('Jan', 35),63 ChartData('Feb', 28),64 ChartData('Mar', 34),65 ChartData('Apr', 32),66 ChartData('May', 40),67 ],68 xValueMapper: (ChartData d, _) => d.x,69 yValueMapper: (ChartData d, _) => d.y,70 name: 'Sales',71 dataLabelSettings: DataLabelSettings(isVisible: true),72 ),73 ],74 ),75 );76 }77}7879class ChartData {80 ChartData(this.x, this.y);81 final String x;82 final double? y;83}84```8586---8788## Navigation Guide8990### Getting Started91📄 **Read:** [references/getting-started.md](references/getting-started.md)92- Package installation and import93- Initialize SfCartesianChart94- Bind data source and data model95- Add title, data labels, legend, tooltip96- Complete minimal working example9798### Line, Area & Spline Chart Types99📄 **Read:** [references/chart-types-line-area.md](references/chart-types-line-area.md)100- Line, fast line, spline (with spline types)101- Step line, area, spline area102- Step area, range area, spline range area103- When to use each type104105### Column, Bar & Other Cartesian Types106📄 **Read:** [references/chart-types-column-bar.md](references/chart-types-column-bar.md)107- Column, bar, range column108- Bubble, scatter, histogram109- Waterfall, error bar, box and whisker110- Key configuration for each type111112### Stacked Chart Types113📄 **Read:** [references/chart-types-stacked.md](references/chart-types-stacked.md)114- Stacked area/bar/column/line115- 100% stacked variants116- When to choose stacked vs 100% stacked117118### Financial Chart Types119📄 **Read:** [references/chart-types-financial.md](references/chart-types-financial.md)120- Candle, HILO, OHLC charts121- Financial data model (open/high/low/close mappers)122- Hollow candle and solid candle123124### Axis Types125📄 **Read:** [references/axis-types.md](references/axis-types.md)126- NumericAxis, CategoryAxis, DateTimeAxis127- DateTimeCategoryAxis, LogarithmicAxis128- Choosing the right axis for your data129130### Axis Customization131📄 **Read:** [references/axis-customization.md](references/axis-customization.md)132- Title, labels, label format133- Gridlines, tick marks, range (min/max/interval)134- Strip lines, multi-level labels135- Secondary axis, axis crossing, inversed axis136137### Series Customization138📄 **Read:** [references/series-customization.md](references/series-customization.md)139- Color, border, opacity, gradient fill140- Dash array, width, point color mapper141- Animation, palette colors, empty point settings142143### Legend144📄 **Read:** [references/legend.md](references/legend.md)145- Enable and position legend146- Toggle series visibility via legend147- Overflow modes (wrap, scroll)148- Custom legend items and icons149150### Tooltip, Trackball & Crosshair151📄 **Read:** [references/tooltip-trackball.md](references/tooltip-trackball.md)152- TooltipBehavior — enable, format, custom template153- Shared tooltip across series154- TrackballBehavior — display modes155- CrosshairBehavior configuration156157### Zooming, Panning & Selection158📄 **Read:** [references/zoom-pan-selection.md](references/zoom-pan-selection.md)159- ZoomPanBehavior — pinch, mouse wheel, directional160- ZoomMode (x, y, xy), panning161- Auto-scrolling for live data162- SelectionBehavior — point, series, cluster, box163164### Annotations, Markers & Data Labels165📄 **Read:** [references/annotations-markers-datalabels.md](references/annotations-markers-datalabels.md)166- CartesianChartAnnotation — text and widget overlays167- Coordinate units (point vs pixel vs percent)168- MarkerSettings — shape, size, color169- DataLabelSettings — position, format, template, connector lines170171### Technical Indicators & Trendlines172📄 **Read:** [references/technical-indicators-trendlines.md](references/technical-indicators-trendlines.md)173- SMA, EMA, TMA, WMA, MACD, RSI, Stochastic174- Bollinger Bands, ATR, CCI, Momentum, AD, ROC175- Trendline types (linear, exponential, polynomial, moving average, power, logarithmic)176- Forecasting periods177178### Chart Appearance & Multiple Charts179📄 **Read:** [references/chart-appearance.md](references/chart-appearance.md)180- Background color/image, plot area customization181- Color palette, theme integration182- Rendering multiple charts on the same screen183- On-demand / lazy data loading184185### Callbacks, Methods, Export & Accessibility186📄 **Read:** [references/callbacks-methods-export.md](references/callbacks-methods-export.md)187- Key callbacks (onTooltipRender, onDataLabelRender, onZooming, etc.)188- ChartSeriesController methods (updateDataSource, animate)189- Export to PNG, PDF, JPEG190- Localization, RTL, accessibility191192---193194## Common Patterns195196### Pattern 1 — Live / Real-Time Data Update197```dart198late ChartSeriesController _controller;199200onRendererCreated: (ChartSeriesController controller) {201 _controller = controller;202},203204void addDataPoint(ChartData newPoint) {205 chartData.add(newPoint);206 _controller.updateDataSource(207 addedDataIndexes: [chartData.length - 1],208 );209}210```211212### Pattern 2 — Multiple Series on One Chart213```dart214series: <CartesianSeries>[215 LineSeries<ChartData, String>(216 dataSource: data,217 xValueMapper: (d, _) => d.x,218 yValueMapper: (d, _) => d.y1,219 name: 'Revenue',220 ),221 ColumnSeries<ChartData, String>(222 dataSource: data,223 xValueMapper: (d, _) => d.x,224 yValueMapper: (d, _) => d.y2,225 name: 'Cost',226 ),227]228```229230### Pattern 3 — Zoom + Tooltip Together231```dart232late ZoomPanBehavior _zoom;233late TooltipBehavior _tooltip;234235@override236void initState() {237 _zoom = ZoomPanBehavior(enablePinching: true, enableDoubleTapZooming: true);238 _tooltip = TooltipBehavior(enable: true);239 super.initState();240}241242zoomPanBehavior: _zoom,243tooltipBehavior: _tooltip,244```245246---247248## Key Widget Properties249250| Property | Type | Purpose |251|----------|------|---------|252| `primaryXAxis` | `ChartAxis` | Horizontal axis type and config |253| `primaryYAxis` | `ChartAxis` | Vertical axis type and config |254| `series` | `List<CartesianSeries>` | One or more data series |255| `title` | `ChartTitle` | Chart heading text |256| `legend` | `Legend` | Legend visibility and position |257| `tooltipBehavior` | `TooltipBehavior` | Tooltip on tap |258| `zoomPanBehavior` | `ZoomPanBehavior` | Zoom and pan interaction |259| `selectionType` | `SelectionType` | Point/series/cluster selection |260| `annotations` | `List<CartesianChartAnnotation>` | Overlay widgets/text |261| `indicators` | `List<TechnicalIndicator>` | Technical analysis overlays |262| `onTooltipRender` | `ChartTooltipCallback` | Customize tooltip text |263| `onZooming` | `ChartZoomingCallback` | Respond to zoom events |264| `palette` | `List<Color>` | Custom series color palette |