calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  _setSegmentProperties();
  _segmentProperties.isBull = _segmentProperties.currentPoint!.open <
      _segmentProperties.currentPoint!.close;
  _segmentProperties.x =
      _segmentProperties.high = _segmentProperties.low = double.nan;
  final SeriesRendererDetails seriesRendererDetails =
      SeriesHelper.getSeriesRendererDetails(
          _segmentProperties.seriesRenderer);
  _isTransposed = seriesRendererDetails.stateProperties.requireInvertedAxis;
  _segmentProperties.lowPoint = _segmentProperties.currentPoint!.lowPoint!;
  _segmentProperties.highPoint = _segmentProperties.currentPoint!.highPoint!;
  _centerLowPoint = _segmentProperties.currentPoint!.centerLowPoint!;
  _centerHighPoint = _segmentProperties.currentPoint!.centerHighPoint!;
  _segmentProperties.x = _segmentProperties.lowPoint.x;
  _segmentProperties.low = _segmentProperties.lowPoint.y;
  _segmentProperties.high = _segmentProperties.highPoint.y;
  _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 =
      (_segmentProperties.series as FinancialSeriesBase<dynamic, dynamic>)
                  .showIndicationForSameValues ==
              true &&
          (seriesRendererDetails.stateProperties.requireInvertedAxis == false
              ? _centerHighPoint.y == _centerLowPoint.y
              : _centerHighPoint.x == _centerLowPoint.x);

  _segmentProperties.x = _segmentProperties.lowPoint.x =
      (_showSameValue && _isTransposed)
          ? _segmentProperties.lowPoint.x - 2
          : _segmentProperties.lowPoint.x;
  _segmentProperties.highPoint.x = (_showSameValue && _isTransposed)
      ? _segmentProperties.highPoint.x + 2
      : _segmentProperties.highPoint.x;
  _segmentProperties.low = _segmentProperties.lowPoint.y =
      (_showSameValue && !_isTransposed)
          ? _segmentProperties.lowPoint.y - 2
          : _segmentProperties.lowPoint.y;
  _segmentProperties.high = _segmentProperties.highPoint.y =
      (_showSameValue && !_isTransposed)
          ? _segmentProperties.highPoint.y + 2
          : _segmentProperties.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 = _segmentProperties.closeY +
      ((_segmentProperties.closeY - _segmentProperties.openY).abs() / 2);
  _segmentProperties.topRectY =
      _centersY - ((_centersY - _segmentProperties.closeY).abs() * 1);
  _segmentProperties.bottomRectY =
      _centersY + ((_centersY - _segmentProperties.openY).abs() * 1);
}