I want a chart which showes data of the last week. Therefore, I use bezier_chart. Everything works, but I want the displayed data to be in a list. Instead of putting the data directly in the data:
(as it is in the tutorial), I gave it directly in the var datatest, but I get an error. The error is: type 'List<dynamic>' is not a subtype of type 'List<DataPoint<DateTime>>' of 'function result'
.
Does anybody know a solution for this problem?
This is my code in the BezierChart:
child: BezierChart(
fromDate: fromDate,
bezierChartScale: BezierChartScale.WEEKLY,
toDate: toDate,
selectedDate: toDate,
series: [
BezierLine(
label: "Duty",
onMissingValue: (dateTime) {
return 0.0;
},
data: dataTest,
),
This is my dataTest list:
var dataTest = [
DataPoint<DateTime>(
value: 10, xAxis: DateTime.now().subtract(Duration(days: 2))),
DataPoint<DateTime>(
value: 100, xAxis: DateTime.now().subtract(Duration(days: 3))),
];
Thsi is the link to the example:
https://pub.dev/packages/bezier_chart
question from:
https://stackoverflow.com/questions/65942493/type-listdynamic-is-not-a-subtype-of-type-listdatapointdatetime-of-fu 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…