LineChart.fromData constructor
LineChart.fromData({})
Convenience constructor — accepts a plain List<double> and converts each value to a ChartPoint using its index as the x coordinate.
Implementation
factory LineChart.fromData({
Key? key,
required List<double> data,
List<String> labels = const [],
Color? color,
bool showArea = true,
bool showDots = true,
bool showGrid = true,
double height = 200,
bool animate = true,
double strokeWidth = 2.5,
}) =>
LineChart(
key: key,
points: <ChartPoint>[
for (int i = 0; i < data.length; i++)
ChartPoint(i.toDouble(), data[i]),
],
labels: labels,
color: color,
showArea: showArea,
showDots: showDots,
showGrid: showGrid,
height: height,
animate: animate,
strokeWidth: strokeWidth,
);