Skip to content

Commit b6d8cc6

Browse files
pd0wmtwilsonco
authored andcommitted
cabana: fix occasional ellipsis on y axis ticks (commaai#27142)
1 parent 3fb2527 commit b6d8cc6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/cabana/chartswidget.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ void ChartView::updateAxisY() {
521521

522522
if (min_y == std::numeric_limits<double>::max()) min_y = 0;
523523
if (max_y == std::numeric_limits<double>::lowest()) max_y = 0;
524-
if (max_y == min_y) {
525-
axis_y->setRange(min_y - 1, max_y + 1);
524+
if (std::abs(max_y - min_y) < 1e-3) {
525+
applyNiceNumbers(min_y - 1, max_y + 1);
526526
} else {
527527
double range = max_y - min_y;
528528
applyNiceNumbers(min_y - range * 0.05, max_y + range * 0.05);
@@ -539,6 +539,7 @@ void ChartView::applyNiceNumbers(qreal min, qreal max) {
539539
tick_count = int(max - min) + 1;
540540
axis_y->setRange(min * step, max * step);
541541
axis_y->setTickCount(tick_count);
542+
axis_y->setLabelFormat("%.1f");
542543
}
543544

544545
// nice numbers can be expressed as form of 1*10^n, 2* 10^n or 5*10^n

0 commit comments

Comments
 (0)