getLabelMaxY method
Get the maximum (the last, the topmost) Y label value.
If _initialLabelMaxY
is null, which means that labelMaxY
value from the constructor
was not supplied, maximum Y label value will be retrieved from
ceil(maximum Y value in data points). There is an exception to this, however.
When the maximum point equals to the minimum point, which means that the
data are flat, max Y label is calculated from ceil(1.2 * maximum Y value in data points).
However, if the maximum data point is 0, multiplying it by 1.2 won't do anything,
and so it will be set to constant 10 instead.
Implementation
double getLabelMaxY() {
if (_initialLabelMaxY != null) return _initialLabelMaxY!;
if (_dataPointMinY == _dataPointMaxY) {
if (_dataPointMaxY == 0) {
return 10;
}
return (1.2 * _dataPointMaxY).ceilToDouble();
}
return _dataPointMaxY.ceilToDouble();
}