calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  _candleSeries = _series as CandleSeries<dynamic, dynamic>;
  _isBull = _currentPoint!.open < _currentPoint!.close;
  _x = _high = _low = double.nan;
  _isTransposed = _seriesRenderer._chartState!._requireInvertedAxis;
  _lowPoint = _currentPoint!.lowPoint!;
  _highPoint = _currentPoint!.highPoint!;
  _centerLowPoint = _currentPoint!.centerLowPoint!;
  _centerHighPoint = _currentPoint!.centerHighPoint!;
  _x = _lowPoint.x;
  _low = _lowPoint.y;
  _high = _highPoint.y;
  _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 = _candleSeries.showIndicationForSameValues &&
      (!_seriesRenderer._chartState!._requireInvertedAxis
          ? _centerHighPoint.y == _centerLowPoint.y
          : _centerHighPoint.x == _centerLowPoint.x);

  _x = _lowPoint.x =
      (_showSameValue && _isTransposed) ? _lowPoint.x - 2 : _lowPoint.x;
  _highPoint.x =
      (_showSameValue && _isTransposed) ? _highPoint.x + 2 : _highPoint.x;
  _low = _lowPoint.y =
      (_showSameValue && !_isTransposed) ? _lowPoint.y - 2 : _lowPoint.y;
  _high = _highPoint.y =
      (_showSameValue && !_isTransposed) ? _highPoint.y + 2 : _highPoint.y;
  _centerHigh = _centerHighPoint.x = (_showSameValue && _isTransposed)
      ? _centerHighPoint.x + 2
      : _centerHighPoint.x;
  _highY = _centerHighPoint.y = (_showSameValue && !_isTransposed)
      ? _centerHighPoint.y + 2
      : _centerHighPoint.y;
  _centerLow = _centerLowPoint.x = (_showSameValue && _isTransposed)
      ? _centerLowPoint.x - 2
      : _centerLowPoint.x;
  _lowY = _centerLowPoint.y = (_showSameValue && !_isTransposed)
      ? _centerLowPoint.y - 2
      : _centerLowPoint.y;
  _centersY = _closeY + ((_closeY - _openY).abs() / 2);
  _topRectY = _centersY - ((_centersY - _closeY).abs() * 1);
  _bottomRectY = _centersY + ((_centersY - _openY).abs() * 1);
}