calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  _hiloOpenCloseSeries = _series as HiloOpenCloseSeries<dynamic, dynamic>;
  _isTransposed = _seriesRenderer._chartState!._requireInvertedAxis;
  _isBull = _currentPoint!.open < _currentPoint!.close;
  _lowPoint = _currentPoint!.lowPoint!;
  _highPoint = _currentPoint!.highPoint!;
  _centerLowPoint = _currentPoint!.centerLowPoint!;
  _centerHighPoint = _currentPoint!.centerHighPoint!;
  _x = _lowX = _lowPoint.x;
  _low = _lowPoint.y;
  _high = _highPoint.y;
  _highX = _highPoint.x;
  _centerHigh = _centerHighPoint.x;
  _highY = _centerHighPoint.y;
  _centerLow = _centerLowPoint.x;
  _lowY = _centerLowPoint.y;
  _openX = _currentPoint!.openPoint!.x;
  _openY = _currentPoint!.openPoint!.y;
  _closeX = _currentPoint!.closePoint!.x;
  _closeY = _currentPoint!.closePoint!.y;

  _showSameValue = _hiloOpenCloseSeries.showIndicationForSameValues &&
      (!_isTransposed
          ? _centerHighPoint.y == _centerLowPoint.y
          : _centerHighPoint.x == _centerLowPoint.x);

  if (_showSameValue) {
    if (_isTransposed) {
      _x = _lowPoint.x = _lowPoint.x - 2;
      _highPoint.x = _highPoint.x + 2;
      _centerHigh = _centerHighPoint.x = _centerHighPoint.x + 2;
      _centerLow = _centerLowPoint.x = _centerLowPoint.x - 2;
    } else {
      _low = _lowPoint.y = _lowPoint.y - 2;
      _high = _highPoint.y = _highPoint.y + 2;
      _highY = _centerHighPoint.y = _centerHighPoint.y + 2;
      _lowY = _centerLowPoint.y = _centerLowPoint.y - 2;
    }
  }
}