getDataPoint method

CartesianChartPoint getDataPoint (
  1. dynamic x,
  2. num y,
  3. CartesianChartPoint sourcePoint,
  4. CartesianSeriesRenderer seriesRenderer,
  5. int index
)

Defines the data point of trendline

Implementation

CartesianChartPoint<dynamic> getDataPoint(
    dynamic x,
    num y,
    CartesianChartPoint<dynamic> sourcePoint,
    CartesianSeriesRenderer seriesRenderer,
    int index) {
  final CartesianChartPoint<dynamic> trendPoint =
      CartesianChartPoint<dynamic>(x, y);
  trendPoint.x = (seriesRenderer._xAxisRenderer is DateTimeAxisRenderer)
      ? DateTime.fromMillisecondsSinceEpoch(x.floor())
      : x;
  trendPoint.y = y;
  trendPoint.xValue = x;
  trendPoint.pointColorMapper = _seriesRenderer._series.color;
  // trendPoint.index = index;
  trendPoint.yValue = y;
  trendPoint.isVisible = true;
  seriesRenderer._minimumX =
      math.min(seriesRenderer._minimumX, trendPoint.xValue);
  seriesRenderer._minimumY =
      math.min(seriesRenderer._minimumY, trendPoint.yValue);
  seriesRenderer._maximumX =
      math.max(seriesRenderer._maximumX, trendPoint.xValue);
  seriesRenderer._maximumY =
      math.max(seriesRenderer._maximumY, trendPoint.yValue);
  return trendPoint;
}