Add a DateTimeAxisSpec
for your time (domain) axis.
var chart = new charts.TimeSeriesChart<TimeSeriesEnergy>(
seriesList,
domainAxis: new charts.DateTimeAxisSpec(
tickFormatterSpec: new charts.AutoDateTimeTickFormatterSpec(
day: new charts.TimeFormatterSpec(
format: 'dd',
transitionFormat: 'dd MMM',
),
),
),
animate: animate,
);
In this example I changed the labels on my chart from the US default of "Jun 25", "27", "29" and "Jul 1" to "25 Jun", "27", "29" and "01 Jul" respectively.
You can change year, day and hour etc formatting too by adding additional TickFormatterSpecs
for each of those.
The transitionFormat
is used when the big value wraps, otherwise format
is used. From my example, transitionFormat was used to format the first tick (so that you can see the month), but not the 27th or 29th as they are the same month. transitionFormat is again used for Jul 1st as the month has changed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…