generateVisibleLabels method

  1. @override
void generateVisibleLabels()
override

Generates the visible axis labels.

Implementation

@override
void generateVisibleLabels() {
  num tempInterval = _axisDetails.visibleRange!.minimum.ceil();
  int position;
  String labelText;
  _axisDetails.visibleLabels = <AxisLabel>[];
  for (;
      tempInterval <= _axisDetails.visibleRange!.maximum;
      tempInterval += _axisDetails.visibleRange!.interval) {
    if (withInRange(tempInterval, _axisDetails)) {
      position = tempInterval.round();
      if (position <= -1 ||
          (_axisDetails.labels.isNotEmpty &&
              position >= _axisDetails.labels.length)) {
        continue;
      } else if (_axisDetails.labels.isNotEmpty &&
          // ignore: unnecessary_null_comparison
          _axisDetails.labels[position] != null) {
        labelText = _axisDetails.labels[position];
      } else {
        continue;
      }
      _axisDetails.triggerLabelRenderEvent(labelText, tempInterval);
    }
  }

  /// Get the maximum label of width and height in axis.
  _axisDetails.calculateMaximumLabelSize(this, _axisDetails.stateProperties);
  if (_axisDetails._categoryAxis.multiLevelLabels != null &&
      _axisDetails._categoryAxis.multiLevelLabels!.isNotEmpty) {
    generateMultiLevelLabels(_axisDetails);
    calculateMultiLevelLabelBounds(_axisDetails);
  }
}