mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
avoid zero size Y axis
This commit is contained in:
parent
d3ed18ae2a
commit
d47271de6c
@ -472,6 +472,7 @@ LineChart::LineChart(Rect position, std::string title, TData data, TIcons icons,
|
||||
int gridLineCount = 10;
|
||||
int gridStep = computeGridStep(maxVal, gridLineCount);
|
||||
niceMaxVal = gridStep * std::ceil(maxVal / gridStep);
|
||||
niceMaxVal = std::max(1, niceMaxVal); // avoid zero size Y axis (if all values are 0)
|
||||
|
||||
// calculate points in chart
|
||||
auto getPoint = [this](int i, std::vector<float> data){
|
||||
|
Loading…
x
Reference in New Issue
Block a user