updateDataPoints method

  1. @override
void updateDataPoints(
  1. List<int>? removedIndexes,
  2. List<int>? addedIndexes,
  3. List<int>? replacedIndexes, [
  4. List<ChartValueMapper<T, num>>? yPaths,
  5. List<List<num>>? chaoticYLists,
  6. List<List<num>>? yLists,
  7. List<ChartValueMapper<T, Object>>? fPaths,
  8. List<List<Object?>>? chaoticFLists,
  9. List<List<Object?>>? fLists,
])

Implementation

@override
void updateDataPoints(
  List<int>? removedIndexes,
  List<int>? addedIndexes,
  List<int>? replacedIndexes, [
  List<ChartValueMapper<T, num>>? yPaths,
  List<List<num>>? chaoticYLists,
  List<List<num>>? yLists,
  List<ChartValueMapper<T, Object>>? fPaths,
  List<List<Object?>>? chaoticFLists,
  List<List<Object?>>? fLists,
]) {
  if (dataSource == null ||
      dataSource!.isEmpty ||
      xValueMapper == null ||
      yValueMapper == null) {
    return;
  }

  if (fPaths == null) {
    fPaths = <ChartValueMapper<T, Object>>[];
    chaoticFLists = <List<Object?>>[];
    fLists = <List<Object?>>[];
  }
  _addPointColorMapper(fPaths, chaoticFLists, fLists);
  _addSortValueMapper(fPaths, chaoticFLists, fLists);

  if (removedIndexes != null) {
    _removeDataPoints(removedIndexes, yPaths, chaoticYLists, yLists, fPaths,
        chaoticFLists, fLists);
  }

  if (addedIndexes != null) {
    _addDataPoints(addedIndexes, yPaths, chaoticYLists, yLists, fPaths,
        chaoticFLists, fLists);
  }

  if (replacedIndexes != null) {
    _replaceDataPoints(replacedIndexes, yPaths, chaoticYLists, yLists, fPaths,
        chaoticFLists, fLists);
  }

  // During sorting, the x, y, and feature path values are recalculated.
  // Therefore, it is necessary to clear the old values and update these lists
  // with the newly recalculated values.
  if (sortingOrder != SortingOrder.none) {
    xValues.clear();
    xRawValues.clear();
    yValues.clear();
  }

  _applyEmptyPointModeIfNeeded(_chaoticYValues);
  _doSortingIfNeeded(_chaoticYValues, yLists, chaoticFLists, fLists);
  final DoubleRange xRange = _findMinMaxXRange(xValues);
  final DoubleRange yRange = _findMinMaxYRange(_chaoticYValues);
  _updateAxisRange(
      xRange.minimum, xRange.maximum, yRange.minimum, yRange.maximum);
  computeNonEmptyYValues();
  _populateTrendlineDataSource();
  _updateXValuesForCategoryTypeAxes();

  canUpdateOrCreateSegments = true;
  markNeedsLayout();
}