calculateSegmentPoints method

  1. @override
void calculateSegmentPoints()
override

Calculates the rendering bounds of a segment.

Implementation

@override
void calculateSegmentPoints() {
  final SegmentProperties segmentProperties =
      SegmentHelper.getSegmentProperties(this);
  final SeriesRendererDetails segmentSeriesRendererDetails =
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer);
  _xAxisRenderer = segmentSeriesRendererDetails.xAxisDetails!;
  _yAxisRenderer = segmentSeriesRendererDetails.yAxisDetails!;
  _axisClipRect = calculatePlotOffset(
      segmentProperties.stateProperties.chartAxis.axisClipRect,
      Offset(segmentSeriesRendererDetails.xAxisDetails!.axis.plotOffset,
          segmentSeriesRendererDetails.yAxisDetails!.axis.plotOffset));
  _currentPointLocation = calculatePoint(
      segmentProperties.currentPoint!.xValue,
      segmentProperties.currentPoint!.yValue,
      _xAxisRenderer,
      _yAxisRenderer,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      _axisClipRect);
  segmentProperties.x1 = _currentPointLocation!.x;
  segmentProperties.y1 = _currentPointLocation!.y;
  _nextPointLocation = calculatePoint(
      segmentProperties.nextPoint!.xValue,
      segmentProperties.nextPoint!.yValue,
      _xAxisRenderer,
      _yAxisRenderer,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      _axisClipRect);
  segmentProperties.x2 = _nextPointLocation!.x;
  segmentProperties.y2 = _nextPointLocation!.y;

  startControlX = segmentProperties.currentPoint!.startControl!.x;
  startControlY = segmentProperties.currentPoint!.startControl!.y;
  endControlX = segmentProperties.currentPoint!.endControl!.x;
  endControlY = segmentProperties.currentPoint!.endControl!.y;
}