createTickFormatter method

  1. @override
DateTimeTickFormatter createTickFormatter(
  1. ChartContext context
)
override

Implementation

@override
DateTimeTickFormatter createTickFormatter(ChartContext context) {
  final map = <int, TimeTickFormatter>{};

  if (minute != null) {
    map[DateTimeTickFormatter.minute] =
        _makeFormatter(minute!, CalendarField.hourOfDay, context);
  }
  if (hour != null) {
    map[DateTimeTickFormatter.hour] =
        _makeFormatter(hour!, CalendarField.date, context);
  }
  if (day != null) {
    map[23 * DateTimeTickFormatter.hour] =
        _makeFormatter(day!, CalendarField.month, context);
  }
  if (month != null) {
    map[28 * DateTimeTickFormatter.day] =
        _makeFormatter(month!, CalendarField.year, context);
  }
  if (year != null) {
    map[364 * DateTimeTickFormatter.day] =
        _makeFormatter(year!, CalendarField.year, context);
  }

  return DateTimeTickFormatter(context.dateTimeFactory, overrides: map);
}