LineChartWidget constructor

LineChartWidget({
  1. Key? key,
  2. required List<ChartDataSet> dataSets,
  3. ChartTheme? theme,
  4. double lineWidth = 3.0,
  5. bool showArea = true,
  6. bool showPoints = true,
  7. bool showGrid = true,
  8. bool showAxis = true,
  9. bool showLabel = true,
  10. String? title,
  11. String? subtitle,
  12. bool useGlassmorphism = false,
  13. bool useNeumorphism = false,
  14. ChartPointCallback? onPointTap,
  15. ChartPointHoverCallback? onPointHover,
  16. bool isLoading = false,
  17. bool isError = false,
  18. String? errorMessage,
})

Creates a line chart widget.

dataSets must not be empty. Each dataset must contain at least one data point. theme is required for styling.

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

LineChartWidget({
  super.key,
  required this.dataSets,
  this.theme,
  this.lineWidth = 3.0,
  this.showArea = true,
  this.showPoints = true,
  this.showGrid = true,
  this.showAxis = true,
  this.showLabel = true,
  this.title,
  this.subtitle,
  this.useGlassmorphism = false,
  this.useNeumorphism = false,
  this.onPointTap,
  this.onPointHover,
  this.isLoading = false,
  this.isError = false,
  this.errorMessage,
})  : assert(
        dataSets.isNotEmpty,
        'LineChartWidget requires at least one data set',
      ),
      assert(lineWidth > 0, 'Line width must be positive'),
      assert(
        !isLoading || !isError,
        'Cannot be both loading and in error state',
      );