AreaChartWidget constructor
const
AreaChartWidget({
- Key? key,
- required List<
ChartDataSet> dataSets, - double lineWidth = 3.0,
- bool showPoints = true,
- bool showGrid = true,
- bool showAxis = true,
- bool showLabel = true,
- String? title,
- String? subtitle,
- Widget? header,
- ChartPointCallback? onPointTap,
- ChartTapCallback? onChartTap,
- bool isLoading = false,
- bool isError = false,
- double? height,
- EdgeInsets? padding,
- EdgeInsets? margin,
- ChartsConfig? config,
- int? xAxisLabelRotation,
- int? yAxisLabelRotation,
Creates an area chart widget.
dataSets must not be empty. Each dataset must contain at least one
data point. Theme is optional and will be inferred from the Material
theme if not provided.
The lineWidth defaults to 3.0 pixels. Use onPointTap to handle
user interactions with data points. The chart will automatically animate
on first build with a smooth entrance animation.
Throws an AssertionError if dataSets is empty or any dataset
is empty.
Example
AreaChartWidget(
dataSets: myDataSets,
title: 'Sales Over Time',
onPointTap: handlePointTap,
)
Implementation
const AreaChartWidget({
super.key,
required this.dataSets,
this.lineWidth = 3.0,
this.showPoints = true,
this.showGrid = true,
this.showAxis = true,
this.showLabel = true,
this.title,
this.subtitle,
this.header,
this.footer,
this.onPointTap,
this.onChartTap,
this.isLoading = false,
this.isError = false,
this.height,
this.padding,
this.margin,
this.config,
this.xAxisLabelRotation,
this.yAxisLabelRotation,
});