update method
dynamic
update()
Implementation
update() {
_min = double.infinity;
_max = -double.infinity;
for (var i in data!) {
if (i.high! > _max!) {
_max = i.high!.toDouble();
}
if (i.low! < _min!) {
_min = i.low!.toDouble();
}
}
if (enableGridLines) {
double gridLineValue;
for (int i = 0; i < gridLineAmount; i++) {
// Label grid lines
gridLineValue = _max! - (((_max! - _min!) / (gridLineAmount - 1)) * i);
String gridLineText;
if (gridLineValue < 1) {
gridLineText = gridLineValue.toStringAsPrecision(4);
} else if (gridLineValue < 999) {
gridLineText = gridLineValue.toStringAsFixed(2);
} else {
gridLineText = gridLineValue.round().toString().replaceAllMapped(
new RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
(Match m) => "${m[1]},");
}
gridLineTextPainters.add(new TextPainter(
text: new TextSpan(
text: labelPrefix + gridLineText,
style: new TextStyle(
color: gridLineLabelColor,
fontSize: 10.0,
fontWeight: FontWeight.bold)),
textDirection: TextDirection.ltr));
gridLineTextPainters[i].layout();
}
}
}