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);
}