LineChartWidget constructor

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

Creates a line chart widget.

dataSets must not be empty. Each dataset contains one data point. Use config for theme, glassmorphism, empty/error messages, and shadows.

The lineWidth defaults to 3.0 pixels. Set showArea to true to fill the area under the line with a gradient. Use onPointTap to handle user interactions with data points.

Implementation

const LineChartWidget({
  super.key,
  required this.dataSets,
  this.lineWidth = 3.0,
  this.showArea = true,
  this.showPoints = true,
  this.showGrid = true,
  this.showAxis = true,
  this.showLabel = true,
  this.title,
  this.subtitle,
  this.header,
  this.footer,
  this.onPointTap,
  this.onPointHover,
  this.onChartTap,
  this.isLoading = false,
  this.isError = false,
  this.height,
  this.padding,
  this.margin,
  this.config,
  this.xAxisLabelRotation,
  this.yAxisLabelRotation,
})  : assert(lineWidth > 0, 'Line width must be positive'),
      assert(
        !isLoading || !isError,
        'Cannot be both loading and in error state',
      );