mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 22:22:11 +08:00
cabana: recalc y-axis label width after unit change (#27466)
recalc width old-commit-hash: 85a37d276c105494b97eee03aa6bb31a212f2f92
This commit is contained in:
@@ -591,11 +591,14 @@ void ChartView::updateAxisY() {
|
||||
if (it->y() > max) max = it->y();
|
||||
}
|
||||
}
|
||||
axis_y->setTitleText(unit);
|
||||
|
||||
if (min == std::numeric_limits<double>::max()) min = 0;
|
||||
if (max == std::numeric_limits<double>::lowest()) max = 0;
|
||||
|
||||
if (axis_y->titleText() != unit) {
|
||||
axis_y->setTitleText(unit);
|
||||
y_label_width = 0;// recalc width
|
||||
}
|
||||
|
||||
double delta = std::abs(max - min) < 1e-3 ? 1 : (max - min) * 0.05;
|
||||
auto [min_y, max_y, tick_count] = getNiceAxisNumbers(min - delta, max + delta, axis_y->tickCount());
|
||||
if (min_y != axis_y->min() || max_y != axis_y->max() || y_label_width == 0) {
|
||||
|
||||
Reference in New Issue
Block a user