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);
  late Rect rect;
  rect = calculatePlotOffset(
      segmentProperties.stateProperties.chartAxis.axisClipRect,
      Offset(segmentSeriesRendererDetails.xAxisDetails!.axis.plotOffset,
          segmentSeriesRendererDetails.yAxisDetails!.axis.plotOffset));

  final ChartLocation currentChartPoint = calculatePoint(
      segmentProperties.currentPoint!.xValue,
      segmentProperties.currentCummulativePos,
      segmentSeriesRendererDetails.xAxisDetails!,
      segmentSeriesRendererDetails.yAxisDetails!,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      rect);
  final ChartLocation nextLocation = calculatePoint(
      segmentProperties.nextPoint!.xValue,
      segmentProperties.nextCummulativePos,
      segmentSeriesRendererDetails.xAxisDetails!,
      segmentSeriesRendererDetails.yAxisDetails!,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      rect);

  final ChartLocation currentCummulativePoint = calculatePoint(
      segmentProperties.currentPoint!.xValue,
      segmentProperties.currentCummulativePos,
      segmentSeriesRendererDetails.xAxisDetails!,
      segmentSeriesRendererDetails.yAxisDetails!,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      rect);

  final ChartLocation nextCummulativePoint = calculatePoint(
      segmentProperties.nextPoint!.xValue,
      segmentProperties.nextCummulativePos,
      segmentSeriesRendererDetails.xAxisDetails!,
      segmentSeriesRendererDetails.yAxisDetails!,
      segmentProperties.stateProperties.requireInvertedAxis,
      segmentProperties.series,
      rect);

  segmentProperties.x1 = currentChartPoint.x;
  segmentProperties.y1 = currentChartPoint.y;
  segmentProperties.x2 = nextLocation.x;
  segmentProperties.y2 = nextLocation.y;
  segmentProperties.currentCummulativeValue = currentCummulativePoint.y;
  segmentProperties.nextCummulativeValue = nextCummulativePoint.y;
}