I am trying to display some data in a time-series chart, I found an example \"https://google.github.io/charts/flutter/example/time_series_charts/simple.html\" but the data i
The first thing to do is to refactor TimeSeriesSales
so that it makes sense in your application, for example:
class TimeSeriesPrice {
final DateTime time;
final double price;
TimeSeriesSales(this.time, this.price);
}
Next, you need to build data
.
List data = [];
// populate data with a list of dates and prices from the json
for (Map m in dataJSON) {
data.add(TimeSeriesPrice(m['date'], m['price']);
}
var series = ...
You don't give an example of the json format, so this is a guess. (You are likely to have to parse the json string date into a Dart DateTime.)