LineChartWidget constructor
LineChartWidget({
- Key? key,
- required List<
ChartDataSet> dataSets, - ChartTheme? theme,
- double lineWidth = 3.0,
- bool showArea = true,
- bool showPoints = true,
- bool showGrid = true,
- bool showAxis = true,
- bool showLabel = true,
- String? title,
- String? subtitle,
- bool useGlassmorphism = false,
- bool useNeumorphism = false,
- ChartPointCallback? onPointTap,
- ChartPointHoverCallback? onPointHover,
- bool isLoading = false,
- bool isError = false,
- 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',
);