copyOldSegmentValues method
void
copyOldSegmentValues()
override
Implementation
@override
void copyOldSegmentValues(
double seriesAnimationFactor, double segmentAnimationFactor) {
if (series.animationType == AnimationType.loading) {
points.clear();
_drawIndexes.clear();
_oldHighPoints.clear();
_oldLowPoints.clear();
return;
}
if (series.animationDuration > 0) {
if (points.isEmpty) {
_oldHighPoints.clear();
_oldLowPoints.clear();
return;
}
final int oldPointsLength = _oldHighPoints.length;
final int newPointsLength = _highPoints.length;
if (oldPointsLength == newPointsLength) {
for (int i = 0; i < oldPointsLength; i++) {
_oldHighPoints[i] = _oldHighPoints[i]
.lerp(_highPoints[i], segmentAnimationFactor, bottom)!;
_oldLowPoints[i] = _oldLowPoints[i]
.lerp(_lowPoints[i], segmentAnimationFactor, bottom)!;
}
} else if (oldPointsLength < newPointsLength) {
for (int i = 0; i < oldPointsLength; i++) {
_oldHighPoints[i] = _oldHighPoints[i]
.lerp(_highPoints[i], segmentAnimationFactor, bottom)!;
_oldLowPoints[i] = _oldLowPoints[i]
.lerp(_lowPoints[i], segmentAnimationFactor, bottom)!;
}
_oldHighPoints.addAll(_highPoints.sublist(oldPointsLength));
_oldLowPoints.addAll(_lowPoints.sublist(oldPointsLength));
} else {
for (int i = 0; i < newPointsLength; i++) {
_oldHighPoints[i] = _oldHighPoints[i]
.lerp(_highPoints[i], segmentAnimationFactor, bottom)!;
_oldLowPoints[i] = _oldLowPoints[i]
.lerp(_lowPoints[i], segmentAnimationFactor, bottom)!;
}
_oldHighPoints.removeRange(newPointsLength, oldPointsLength);
_oldLowPoints.removeRange(newPointsLength, oldPointsLength);
}
} else {
_oldHighPoints.clear();
_oldLowPoints.clear();
}
}