AreaChartWidget constructor

const AreaChartWidget({
  1. Key? key,
  2. required List<ChartDataSet> dataSets,
  3. double lineWidth = 3.0,
  4. bool showPoints = true,
  5. bool showGrid = true,
  6. bool showAxis = true,
  7. bool showLabel = true,
  8. String? title,
  9. String? subtitle,
  10. Widget? header,
  11. Widget? footer,
  12. ChartPointCallback? onPointTap,
  13. ChartTapCallback? onChartTap,
  14. bool isLoading = false,
  15. bool isError = false,
  16. double? height,
  17. EdgeInsets? padding,
  18. EdgeInsets? margin,
  19. ChartsConfig? config,
  20. int? xAxisLabelRotation,
  21. 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,
});