calculateVisibleRange method

  1. @override
void calculateVisibleRange(
  1. Size availableSize
)
override

Calculates the visible range for an axis in chart.

Implementation

@override
void calculateVisibleRange(Size availableSize) {
  _axisDetails.setOldRangeFromRangeController();
  _axisDetails.visibleRange =
      _axisDetails.stateProperties.rangeChangeBySlider &&
              _axisDetails.rangeMinimum != null &&
              _axisDetails.rangeMaximum != null
          ? VisibleRange(_axisDetails.rangeMinimum, _axisDetails.rangeMaximum)
          : VisibleRange(_axisDetails.actualRange!.minimum,
              _axisDetails.actualRange!.maximum);
  _axisDetails.visibleRange!.delta = _axisDetails.actualRange!.delta;
  _axisDetails.visibleRange!.interval = _axisDetails.actualRange!.interval;
  bool canAutoScroll = false;
  if (_axisDetails._categoryAxis.autoScrollingDelta != null &&
      _axisDetails._categoryAxis.autoScrollingDelta! > 0 &&
      !_axisDetails.stateProperties.isRedrawByZoomPan) {
    canAutoScroll = true;
    _axisDetails.updateAutoScrollingDelta(
        _axisDetails._categoryAxis.autoScrollingDelta!, this);
  }
  if ((!canAutoScroll ||
          (_axisDetails.stateProperties.zoomedState ?? false)) &&
      !(_axisDetails.stateProperties.rangeChangeBySlider &&
          !_axisDetails.stateProperties.canSetRangeController)) {
    _axisDetails.setZoomFactorAndPosition(
        this, _axisDetails.stateProperties.zoomedAxisRendererStates);
  }
  if (_axisDetails.zoomFactor < 1 ||
      _axisDetails.zoomPosition > 0 ||
      (_axisDetails.axis.rangeController != null &&
          !_axisDetails.stateProperties.renderingDetails.initialRender!)) {
    _axisDetails.stateProperties.zoomProgress = true;
    _axisDetails.calculateZoomRange(this, availableSize);
    if (_axisDetails.axis.rangeController != null &&
        _axisDetails.stateProperties.isRedrawByZoomPan &&
        _axisDetails.stateProperties.canSetRangeController &&
        _axisDetails.stateProperties.zoomProgress) {
      _axisDetails.stateProperties.rangeChangedByChart = true;
      _axisDetails.setRangeControllerValues(this);
    }
  }
  _axisDetails.setZoomValuesFromRangeController();
}