I have implemented a time series chart in my flutter app which displays energy data over time:
final List<charts.Series<TimeSeriesEnergy, DateTime>> seriesList = [
new charts.Series<TimeSeriesEnergy, DateTime>(
id: 'Energy',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (TimeSeriesEnergy p, _) => p.time,
measureFn: (TimeSeriesEnergy p, _) => p.energy,
data: data,
)
];
final bool animate = true;
var chart = new charts.TimeSeriesChart<TimeSeriesEnergy>(
seriesList,
animate: animate,
);
I would like now to change the format of the labels on the xAxis, so that they display the time in hours and minutes, rather then the default local date time format. The example in the charts_flutter gallery suggest implementing a DateTimeFactory
, but I have no idea on how to do this. Any suggestions are welcome :)