populateDataSource method
void
populateDataSource([
- List<
ChartValueMapper< ? yPaths,T, num> > - List<
List< ? chaoticYLists,num> > - List<
List< ? yLists,num> > - List<
ChartValueMapper< ? fPaths,T, Object> > - List<
List< ? chaoticFLists,Object?> > - List<
List< ? fLists,Object?> >
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?>>? chaoticFLists,
List<List<Object?>>? fLists,
]) {
super.populateDataSource(
yPaths, chaoticYLists, yLists, fPaths, chaoticFLists, fLists);
if (dataCount < 1) {
return;
}
if (canFindLinearVisibleIndexes) {
_sortedXValues = xValues;
} else {
final List<num?> xValuesCopy = <num?>[...xValues];
xValuesCopy.sort();
_sortedXValues = xValuesCopy;
}
num minDelta = double.infinity;
final int length = _sortedXValues.length;
if (length == 1) {
DateTime? minDate;
num? minimumInSeconds;
if (xAxis is RenderDateTimeAxis) {
minDate = DateTime.fromMillisecondsSinceEpoch(_sortedXValues[0] as int);
minDate = minDate.subtract(const Duration(days: 1));
minimumInSeconds = minDate.millisecondsSinceEpoch;
}
final num seriesMin =
(xAxis is RenderDateTimeAxis && xRange.minimum == xRange.maximum)
? minimumInSeconds!
: xRange.minimum;
final num minVal = xValues[0] - seriesMin;
if (minVal != 0) {
minDelta = min(minDelta, minVal);
}
} else {
for (int i = 0; i < length - 1; 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();
}
}