updateDataPoints method
void
updateDataPoints(])
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();
}