calculateTrendlinePoints method

void calculateTrendlinePoints(
  1. CartesianSeriesRenderer seriesRenderer,
  2. SfCartesianChartState _chartState
)

To find the actual points of trend line series

Implementation

void calculateTrendlinePoints(CartesianSeriesRenderer seriesRenderer,
    SfCartesianChartState _chartState) {
  final Rect rect = _calculatePlotOffset(
      _chartState._chartAxis._axisClipRect,
      Offset(seriesRenderer._xAxisRenderer!._axis.plotOffset,
          seriesRenderer._yAxisRenderer!._axis.plotOffset));
  _points = <Offset>[];
  if (seriesRenderer._series.trendlines != null && _pointsData != null) {
    for (int i = 0; i < _pointsData!.length; i++) {
      if (_pointsData![i].x != null && _pointsData![i].y != null) {
        final _ChartLocation currentChartPoint = _pointsData![i].markerPoint =
            _calculatePoint(
                (seriesRenderer._xAxisRenderer is DateTimeAxisRenderer)
                    ? _pointsData![i].xValue
                    : _pointsData![i].x,
                _pointsData![i].y,
                seriesRenderer._xAxisRenderer!,
                seriesRenderer._yAxisRenderer!,
                _chartState._requireInvertedAxis,
                seriesRenderer._series,
                rect);
        _points.add(Offset(currentChartPoint.x, currentChartPoint.y));
        _pointsData![i].region = Rect.fromLTRB(
            _points[i].dx, _points[i].dy, _points[i].dx, _points[i].dy);
      }
    }
    _calculateMarkerShapesPoint(seriesRenderer);
  }
}