LineChartWidget constructor
const
LineChartWidget({
- Key? key,
- required List<
ChartDataSet> dataSets, - double lineWidth = 3.0,
- bool showArea = true,
- bool showPoints = true,
- bool showGrid = true,
- bool showAxis = true,
- bool showLabel = true,
- String? title,
- String? subtitle,
- Widget? header,
- ChartPointCallback? onPointTap,
- ChartPointHoverCallback? onPointHover,
- ChartTapCallback? onChartTap,
- bool isLoading = false,
- bool isError = false,
- double? height,
- EdgeInsets? padding,
- EdgeInsets? margin,
- ChartsConfig? config,
- int? xAxisLabelRotation,
- 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',
);