setData method
Implementation
@override
void setData(int index, ChartSegment segment) {
super.setData(index, segment);
_startControlX1Values.clear();
_startControlY1Values.clear();
_endControlX1Values.clear();
_endControlY1Values.clear();
_startControlX2Values.clear();
_startControlY2Values.clear();
_endControlX2Values.clear();
_endControlY2Values.clear();
final List<num?> highCoefficients = List<num?>.filled(dataCount, 0);
final List<num?> lowCoefficients = List<num?>.filled(dataCount, 0);
_yMax = double.negativeInfinity;
_isHigh = true;
for (int i = 0; i < 2; i++) {
final num x1 = xValues[index];
final num y1 =
_isHigh ? nonEmptyHighValues[index] : nonEmptyLowValues[index];
num x2 = double.nan;
num y2 = double.nan;
final int nextIndex = index + 1;
if (nextIndex < dataCount) {
x2 = xValues[nextIndex];
y2 = _isHigh
? nonEmptyHighValues[nextIndex]
: nonEmptyLowValues[nextIndex];
}
_buildSplineAreaSegment(
_isHigh ? highCoefficients : lowCoefficients,
x1,
y1,
nextIndex,
x2,
y2,
_isHigh ? nonEmptyHighValues : nonEmptyLowValues,
_isHigh ? _startControlX1Values : _startControlX2Values,
_isHigh ? _startControlY1Values : _startControlY2Values,
_isHigh ? _endControlX1Values : _endControlX2Values,
_isHigh ? _endControlY1Values : _endControlY2Values,
);
_isHigh = false;
}
segment as SplineRangeAreaSegment<T, D>
..series = this
..currentSegmentIndex = 0
.._xValues = xValues
.._highValues = highValues
.._lowValues = lowValues
.._startControlHighXValues = _startControlX1Values
.._startControlHighYValues = _startControlY1Values
.._endControlHighXValues = _endControlX1Values
.._endControlHighYValues = _endControlY1Values
.._startControlLowXValues = _startControlX2Values
.._startControlLowYValues = _startControlY2Values
.._endControlLowXValues = _endControlX2Values
.._endControlLowYValues = _endControlY2Values;
}