getPolynomialCurve method

List<Offset> getPolynomialCurve(
  1. List<CartesianChartPoint> points,
  2. CartesianSeriesRenderer seriesRenderer,
  3. SfCartesianChartState _chartState
)

It returns the polynomial points

Implementation

List<Offset> getPolynomialCurve(
    List<CartesianChartPoint<dynamic>> points,
    CartesianSeriesRenderer seriesRenderer,
    SfCartesianChartState _chartState) {
  final List<Offset> polyPoints = <Offset>[];
  final dynamic start = seriesRenderer._xAxisRenderer is DateTimeAxisRenderer
      ? points[0].xValue
      : points[0].x;
  final dynamic end = seriesRenderer._xAxisRenderer is DateTimeAxisRenderer
      ? points[points.length - 1].xValue
      : points[points.length - 1].xValue;
  for (dynamic x = start;
      polyPoints.length <= 100;
      x += (end - start) / 100) {
    final dynamic y = _getPolynomialYValue(_polynomialSlopes!, x);
    final _ChartLocation position = _calculatePoint(
        x,
        y,
        seriesRenderer._xAxisRenderer!,
        seriesRenderer._yAxisRenderer!,
        _chartState._requireInvertedAxis,
        seriesRenderer._series,
        _chartState._chartAxis._axisClipRect);
    polyPoints.add(Offset(position.x, position.y));
  }
  return polyPoints;
}