mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-27 11:42:10 +08:00
Cabana: fix auto zoom y-axis for multiple line series (#26558)
auto zoom y-axis for multiple series
old-commit-hash: 7b46928fc9
This commit is contained in:
@@ -365,10 +365,10 @@ void ChartView::updateAxisY() {
|
||||
}
|
||||
} else {
|
||||
for (auto &s : sigs) {
|
||||
for (int i = 0; i < s.series->count(); ++i) {
|
||||
double y = s.series->at(i).y();
|
||||
if (y < min_y) min_y = y;
|
||||
if (y > max_y) max_y = y;
|
||||
auto begin = std::lower_bound(s.vals.begin(), s.vals.end(), axis_x->min(), [](auto &p, double x) { return p.x() < x; });
|
||||
for (auto it = begin; it != s.vals.end() && it->x() <= axis_x->max(); ++it) {
|
||||
if (it->y() < min_y) min_y = it->y();
|
||||
if (it->y() > max_y) max_y = it->y();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user