Cabana: fix auto zoom y-axis for multiple line series (#26558)

auto zoom y-axis for multiple series
pull/26568/head
Dean Lee 2 years ago committed by GitHub
parent 2b4b0cc67f
commit 7b46928fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      tools/cabana/chartswidget.cc

@ -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();
}
}
}

Loading…
Cancel
Save