diff --git a/tools/cabana/chart/chart.cc b/tools/cabana/chart/chart.cc index 23ea21f4fd..1d61d543dd 100644 --- a/tools/cabana/chart/chart.cc +++ b/tools/cabana/chart/chart.cc @@ -534,8 +534,8 @@ void ChartView::showTip(double sec) { } tooltip_x = chart()->mapToPosition({sec, 0}).x(); - qreal x = tooltip_x; - QStringList text_list(QString::number(chart()->mapToValue({x, 0}).x(), 'f', 3)); + qreal x = -1; + QStringList text_list; for (auto &s : sigs) { if (s.series->isVisible()) { QString value = "--"; @@ -553,7 +553,11 @@ void ChartView::showTip(double sec) { .arg(s.series->color().name(), name, value, min, max); } } + if (x < 0) { + x = tooltip_x; + } QPoint pt(x, chart()->plotArea().top()); + text_list.push_front(QString::number(chart()->mapToValue({x, 0}).x(), 'f', 3)); QString text = "

" % text_list.join("
") % "

"; tip_label.showText(pt, text, this, visible_rect); viewport()->update(); diff --git a/tools/cabana/chart/tiplabel.cc b/tools/cabana/chart/tiplabel.cc index 37c00834c3..f34d7e8dfe 100644 --- a/tools/cabana/chart/tiplabel.cc +++ b/tools/cabana/chart/tiplabel.cc @@ -30,9 +30,9 @@ void TipLabel::showText(const QPoint &pt, const QString &text, QWidget *w, const if (!text.isEmpty()) { QSize extra(1, 1); resize(sizeHint() + extra); - QPoint tip_pos(pt.x() + 12, rect.top() + 2); + QPoint tip_pos(pt.x() + 8, rect.top() + 2); if (tip_pos.x() + size().width() >= rect.right()) { - tip_pos.rx() = pt.x() - size().width() - 12; + tip_pos.rx() = pt.x() - size().width() - 8; } if (rect.contains({tip_pos, size()})) { move(w->mapToGlobal(tip_pos));