calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  _setSegmentProperties();
  _hiloOpenCloseSeries =
      _segmentProperties.series as HiloOpenCloseSeries<dynamic, dynamic>;
  _isTransposed =
      SeriesHelper.getSeriesRendererDetails(_segmentProperties.seriesRenderer)
          .stateProperties
          .requireInvertedAxis;
  _segmentProperties.isBull = _segmentProperties.currentPoint!.open <
      _segmentProperties.currentPoint!.close;
  _segmentProperties.lowPoint = _segmentProperties.currentPoint!.lowPoint!;
  _segmentProperties.highPoint = _segmentProperties.currentPoint!.highPoint!;
  _centerLowPoint = _segmentProperties.currentPoint!.centerLowPoint!;
  _centerHighPoint = _segmentProperties.currentPoint!.centerHighPoint!;
  _segmentProperties.x = _lowX = _segmentProperties.lowPoint.x;
  _segmentProperties.low = _segmentProperties.lowPoint.y;
  _segmentProperties.high = _segmentProperties.highPoint.y;
  _highX = _segmentProperties.highPoint.x;
  _centerHigh = _centerHighPoint.x;
  _highY = _centerHighPoint.y;
  _centerLow = _centerLowPoint.x;
  _lowY = _centerLowPoint.y;
  _segmentProperties.openX = _segmentProperties.currentPoint!.openPoint!.x;
  _segmentProperties.openY = _segmentProperties.currentPoint!.openPoint!.y;
  _segmentProperties.closeX = _segmentProperties.currentPoint!.closePoint!.x;
  _segmentProperties.closeY = _segmentProperties.currentPoint!.closePoint!.y;

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

  if (_showSameValue) {
    if (_isTransposed) {
      _segmentProperties.x =
          _segmentProperties.lowPoint.x = _segmentProperties.lowPoint.x - 2;
      _segmentProperties.highPoint.x = _segmentProperties.highPoint.x + 2;
      _centerHigh = _centerHighPoint.x = _centerHighPoint.x + 2;
      _centerLow = _centerLowPoint.x = _centerLowPoint.x - 2;
    } else {
      _segmentProperties.low =
          _segmentProperties.lowPoint.y = _segmentProperties.lowPoint.y - 2;
      _segmentProperties.high =
          _segmentProperties.highPoint.y = _segmentProperties.highPoint.y + 2;
      _highY = _centerHighPoint.y = _centerHighPoint.y + 2;
      _lowY = _centerLowPoint.y = _centerLowPoint.y - 2;
    }
  }
}