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 ChartAxisRendererDetails xAxisRendererDetails =
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .xAxisDetails!;
  final ChartAxisRendererDetails yAxisRendererDetails =
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .yAxisDetails!;
  final Rect axisClipRect = calculatePlotOffset(
      segmentProperties.stateProperties.chartAxis.axisClipRect,
      Offset(
          SeriesHelper.getSeriesRendererDetails(
                  segmentProperties.seriesRenderer)
              .xAxisDetails!
              .axis
              .plotOffset,
          SeriesHelper.getSeriesRendererDetails(
                  segmentProperties.seriesRenderer)
              .yAxisDetails!
              .axis
              .plotOffset));
  _currentLocation = calculatePoint(
      segmentProperties.currentPoint!.xValue,
      segmentProperties.currentPoint!.yValue,
      xAxisRendererDetails,
      yAxisRendererDetails,
      segmentProperties.stateProperties.requireInvertedAxis,
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .series,
      axisClipRect);
  _nextLocation = calculatePoint(
      segmentProperties.nextPoint!.xValue,
      segmentProperties.nextPoint!.yValue,
      xAxisRendererDetails,
      yAxisRendererDetails,
      segmentProperties.stateProperties.requireInvertedAxis,
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .series,
      axisClipRect);
  _midLocation = calculatePoint(
      segmentProperties.midX,
      segmentProperties.midY,
      xAxisRendererDetails,
      yAxisRendererDetails,
      segmentProperties.stateProperties.requireInvertedAxis,
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .series,
      axisClipRect);
  segmentProperties.x1 = _currentLocation.x;
  segmentProperties.y1 = _currentLocation.y;
  segmentProperties.x2 = _nextLocation.x;
  segmentProperties.y2 = _nextLocation.y;
  segmentProperties.x3 = _midLocation.x;
  segmentProperties.y3 = _midLocation.y;
}