calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  _setSegmentProperties();
  _hiloSeries = _segmentProperties.series as HiloSeries<dynamic, dynamic>;
  _segmentProperties.x =
      _segmentProperties.high = _segmentProperties.low = double.nan;
  _segmentProperties.lowPoint = _segmentProperties.currentPoint!.lowPoint!;
  _segmentProperties.highPoint = _segmentProperties.currentPoint!.highPoint!;

  _isTransposed =
      SeriesHelper.getSeriesRendererDetails(_segmentProperties.seriesRenderer)
          .stateProperties
          .requireInvertedAxis;

  _segmentProperties.x = _segmentProperties.lowPoint.x;
  _segmentProperties.low = _segmentProperties.lowPoint.y;
  _segmentProperties.high = _segmentProperties.highPoint.y;

  _showSameValue = _hiloSeries.showIndicationForSameValues &&
      (!_isTransposed
          ? _segmentProperties.low == _segmentProperties.high
          : _segmentProperties.lowPoint.x == _segmentProperties.highPoint.x);

  if (_showSameValue) {
    if (_isTransposed) {
      _segmentProperties.x =
          _segmentProperties.lowPoint.x = _segmentProperties.lowPoint.x - 2;
      _segmentProperties.highPoint.x = _segmentProperties.highPoint.x + 2;
    } else {
      _segmentProperties.low =
          _segmentProperties.lowPoint.y = _segmentProperties.lowPoint.y - 2;
      _segmentProperties.high =
          _segmentProperties.highPoint.y = _segmentProperties.highPoint.y + 2;
    }
  }
}