applyRangePadding method
Applies range padding to auto, normal, additional, round, and none types.
Implementation
@override
void applyRangePadding(_VisibleRange range, num? interval) {
ActualRangeChangedArgs rangeChangedArgs;
if (!(_numericAxis.minimum != null && _numericAxis.maximum != null)) {
///Calculating range padding
_applyRangePadding(this, _chartState, range, interval!);
}
calculateVisibleRange(_axisSize);
/// Setting range as visible zoomRange
if ((_numericAxis.visibleMinimum != null ||
_numericAxis.visibleMaximum != null) &&
(_numericAxis.visibleMinimum != _numericAxis.visibleMaximum) &&
(!_chartState._isRedrawByZoomPan)) {
_chartState._isRedrawByZoomPan = false;
_visibleRange!.minimum = _visibleMinimum ??
_numericAxis.visibleMinimum ??
_visibleRange!.minimum;
_visibleRange!.maximum = _visibleMaximum ??
_numericAxis.visibleMaximum ??
_visibleRange!.maximum;
_visibleRange!.delta = _visibleRange!.maximum - _visibleRange!.minimum;
_visibleRange!.interval = interval == null
? _calculateNumericNiceInterval(
this, _visibleRange!.maximum - _visibleRange!.minimum, _axisSize)
: _visibleRange!.interval;
_zoomFactor = _visibleRange!.delta / range.delta;
_zoomPosition =
(_visibleRange!.minimum - _actualRange!.minimum) / range.delta;
}
if (_chart.onActualRangeChanged != null) {
rangeChangedArgs = ActualRangeChangedArgs(_name!, _numericAxis,
range.minimum, range.maximum, range.interval, _orientation!);
rangeChangedArgs.visibleMin = _visibleRange!.minimum;
rangeChangedArgs.visibleMax = _visibleRange!.maximum;
rangeChangedArgs.visibleInterval = _visibleRange!.interval;
_chart.onActualRangeChanged!(rangeChangedArgs);
_visibleRange!.minimum = rangeChangedArgs.visibleMin;
_visibleRange!.maximum = rangeChangedArgs.visibleMax;
_visibleRange!.delta = _visibleRange!.maximum - _visibleRange!.minimum;
_visibleRange!.interval = rangeChangedArgs.visibleInterval;
_zoomFactor = _visibleRange!.delta / range.delta;
_zoomPosition =
(_visibleRange!.minimum - _actualRange!.minimum) / range.delta;
}
}