populateDataSource method

  1. @override
void populateDataSource([
  1. List<ChartValueMapper<T, num>>? yPaths,
  2. List<List<num>>? chaoticYLists,
  3. List<List<num>>? yLists,
  4. List<ChartValueMapper<T, Object>>? fPaths,
  5. List<List<Object?>>? fLists,
])
inherited

Implementation

@override
void populateDataSource([
  List<ChartValueMapper<T, num>>? yPaths,
  List<List<num>>? chaoticYLists,
  List<List<num>>? yLists,
  List<ChartValueMapper<T, Object>>? fPaths,
  List<List<Object?>>? fLists,
]) {
  super.populateDataSource(yPaths, chaoticYLists, yLists, fPaths, fLists);

  if (dataCount < 1) {
    return;
  }

  if (_hasLinearData) {
    _sortedXValues = xValues;
  } else {
    final List<num?> xValuesCopy = <num?>[...xValues];
    xValuesCopy.sort();
    _sortedXValues = xValuesCopy;
  }

  num minDelta = double.infinity;
  final int length = _sortedXValues.length - 1;
  for (int i = 0; i < length; i++) {
    final num? current = _sortedXValues[i];
    final num? next = _sortedXValues[i + 1];
    if (current == null || next == null) {
      continue;
    }

    final num delta = (next - current).abs();
    minDelta = min(delta == 0 ? minDelta : delta, minDelta);
  }

  primaryAxisAdjacentDataPointsMinDiff = minDelta.isInfinite ? 1 : minDelta;

  if (this is! WaterfallSeriesRenderer) {
    populateChartPoints();
  }
}