Skip to content

Commit e4bb7dd

Browse files
committed
When there are null values, make the chart smooth instead of filling them with a default value of 0.
1 parent c800b15 commit e4bb7dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/chart/render/decorations/spark_line_decoration.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ class SparkLineDecoration extends DecorationPainter {
136136
_positions.add(Offset(_itemWidth * key + _position, 0.0));
137137
}
138138

139-
_positions.add(Offset(_itemWidth * key + _position,
140-
size.height - ((value.max ?? 0.0) - state.data.minValue) * scale));
139+
if (value.max != null) {
140+
_positions.add(Offset(_itemWidth * key + _position,
141+
size.height - ((value.max ?? 0.0) - state.data.minValue) * scale));
142+
}
141143

142144
if (fill && state.data.items[listIndex].length - 1 == key) {
143145
_positions.add(Offset(_itemWidth * key + _position, 0.0));

0 commit comments

Comments
 (0)