generateVisibleLabels method

  1. @override
void generateVisibleLabels()
override

Generates the visible axis labels.

Implementation

@override
void generateVisibleLabels() {
  _visibleLabels = <AxisLabel>[];
  int interval = _visibleRange!.minimum;
  interval = _alignRangeStart(this, interval, _visibleRange!.interval);
  while (interval <= _visibleRange!.maximum) {
    if (_withInRange(interval, _visibleRange!)) {
      final DateFormat format =
          _dateTimeAxis.dateFormat ?? _getDateTimeLabelFormat(this);
      String labelText =
          format.format(DateTime.fromMillisecondsSinceEpoch(interval));
      if (_dateTimeAxis.labelFormat != null &&
          _dateTimeAxis.labelFormat != '') {
        labelText = _dateTimeAxis.labelFormat!
            .replaceAll(RegExp('{value}'), labelText);
      }
      _triggerLabelRenderEvent(labelText, interval);
    }
    interval =
        _increaseDateTimeInterval(this, interval, _visibleRange!.interval)
            .millisecondsSinceEpoch;
  }
  _calculateMaximumLabelSize(this, _chartState);
}