addPoint method

void addPoint(
  1. String seriesId,
  2. ChartDataPoint point
)

Adds a data point to the specified series.

If the series doesn't exist, it will be created. Validates that coordinates are not NaN or infinity. Notifies listeners after the point is added.

Throws AssertionError if coordinates are NaN or infinity.

Implementation

void addPoint(String seriesId, ChartDataPoint point) {
  assert(point.x.isFinite && point.y.isFinite,
      'Cannot add point with NaN or infinity coordinates');

  final series = _seriesData.putIfAbsent(seriesId, () => []);
  series.add(point);

  _revision++;
  notifyListeners();
}