calculateRange method

void calculateRange(
  1. ChartAxisRenderer _axisRenderer
)

To calculate the range points

Implementation

void calculateRange(ChartAxisRenderer _axisRenderer) {
  _min = null;
  _max = null;
  List<CartesianSeriesRenderer> seriesRenderers;
  CartesianSeriesRenderer seriesRenderer;
  double paddingInterval = 0;
  ChartAxisRenderer _xAxisRenderer, _yAxisRenderer;
  num? minimumX, maximumX, minimumY, maximumY;
  String seriesType;
  seriesRenderers = _seriesRenderers;
  for (int i = 0; i < seriesRenderers.length; i++) {
    seriesRenderer = seriesRenderers[i];
    minimumX = seriesRenderer._minimumX;
    maximumX = seriesRenderer._maximumX;
    minimumY = seriesRenderer._minimumY;
    maximumY = seriesRenderer._maximumY;
    seriesType = seriesRenderer._seriesType;
    if (seriesRenderer._visible! &&
        minimumX != null &&
        maximumX != null &&
        minimumY != null &&
        maximumY != null) {
      paddingInterval = 0;
      _xAxisRenderer = seriesRenderer._xAxisRenderer!;
      _yAxisRenderer = seriesRenderer._yAxisRenderer!;
      if (((_xAxisRenderer is DateTimeAxisRenderer ||
                  _xAxisRenderer is NumericAxisRenderer) &&
              _xAxisRenderer._axis.rangePadding == ChartRangePadding.auto) &&
          (seriesType.contains('column') ||
              seriesType.contains('bar') ||
              seriesType == 'histogram')) {
        seriesRenderer._minDelta = seriesRenderer._minDelta ??
            _calculateMinPointsDelta(
                _xAxisRenderer, seriesRenderers, _chartState);
        paddingInterval = seriesRenderer._minDelta! / 2;
      }
      if (((_chartState._requireInvertedAxis
                  ? _yAxisRenderer
                  : _xAxisRenderer) ==
              _axisRenderer) &&
          _orientation == AxisOrientation.horizontal) {
        _chartState._requireInvertedAxis
            ? _findMinMax(minimumY, maximumY)
            : _findMinMax(
                minimumX - paddingInterval, maximumX + paddingInterval);
      }

      if (((_chartState._requireInvertedAxis
                  ? _xAxisRenderer
                  : _yAxisRenderer) ==
              _axisRenderer) &&
          _orientation == AxisOrientation.vertical) {
        _chartState._requireInvertedAxis
            ? _findMinMax(
                minimumX - paddingInterval, maximumX + paddingInterval)
            : _findMinMax(minimumY, maximumY);
      }
    }
  }
}