sparkline function
Draws values as one block character per value, scaled from zero to the
highest value. A null value is drawn as a space.
Implementation
String sparkline(final List<double?> values) {
final double highest = values.nonNulls.fold<double>(0, math.max);
return [
for (final double? value in values)
if (value == null)
' '
else if (highest <= 0)
_sparklineBlocks.first
else
_sparklineBlocks[math.min(
_sparklineBlocks.length - 1,
(value / highest * (_sparklineBlocks.length - 1)).round(),
)],
].join();
}