generateVisibleLabels method Null safety

  1. @override
void generateVisibleLabels()
override

Generates the visible axis labels.

Implementation

@override
void generateVisibleLabels() {
  num tempInterval = _axisDetails.visibleRange!.minimum;
  String labelText;
  _axisDetails.visibleLabels = <AxisLabel>[];
  for (;
      tempInterval <= _axisDetails.visibleRange!.maximum;
      tempInterval += _axisDetails.visibleRange!.interval) {
    labelText =
        pow(_axisDetails.logarithmicAxis.logBase, tempInterval).toString();
    if (_axisDetails.logarithmicAxis.numberFormat != null) {
      labelText = _axisDetails.logarithmicAxis.numberFormat!
          .format(pow(_axisDetails.logarithmicAxis.logBase, tempInterval));
    }
    if (_axisDetails.logarithmicAxis.labelFormat != null &&
        _axisDetails.logarithmicAxis.labelFormat != '') {
      labelText = _axisDetails.logarithmicAxis.labelFormat!
          .replaceAll(RegExp('{value}'), labelText);
    }
    _axisDetails.triggerLabelRenderEvent(labelText, tempInterval);
  }

  /// Get the maximum label of width and height in axis.
  _axisDetails.calculateMaximumLabelSize(this, _axisDetails.stateProperties);
}