From e1f08bc9c70e26e834f30e2c51bd16f355d8f9bd Mon Sep 17 00:00:00 2001 From: Tammo Jan Dijkema Date: Fri, 8 Oct 2021 12:16:00 +0200 Subject: [PATCH 1/2] Add s in ticks --- src/plotview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plotview.cpp b/src/plotview.cpp index 914c2c9..73777fd 100644 --- a/src/plotview.cpp +++ b/src/plotview.cpp @@ -492,7 +492,7 @@ void PlotView::paintTimeScale(QPainter &painter, QRect &rect, range_t sa int tickLine = sampleToColumn(tickSample - sampleRange.minimum); char buf[128]; - snprintf(buf, sizeof(buf), "%.06f", tick); + snprintf(buf, sizeof(buf), "%.06f s", tick); painter.drawLine(tickLine, 0, tickLine, 30); painter.drawText(tickLine + 2, 25, buf); From d67520e493f0ea4d56543d9809b432709c60ef99 Mon Sep 17 00:00:00 2001 From: Tammo Jan Dijkema Date: Fri, 8 Oct 2021 12:28:21 +0200 Subject: [PATCH 2/2] Decrease number of digit in time ticks --- src/plotview.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plotview.cpp b/src/plotview.cpp index 73777fd..924bdb0 100644 --- a/src/plotview.cpp +++ b/src/plotview.cpp @@ -492,7 +492,15 @@ void PlotView::paintTimeScale(QPainter &painter, QRect &rect, range_t sa int tickLine = sampleToColumn(tickSample - sampleRange.minimum); char buf[128]; - snprintf(buf, sizeof(buf), "%.06f s", tick); + if (duration < .5) + snprintf(buf, sizeof(buf), "%.06f s", tick); + else if (duration < 3) + snprintf(buf, sizeof(buf), "%.02f s", tick); + else if (duration < 10) + snprintf(buf, sizeof(buf), "%.02f s", tick); + else + snprintf(buf, sizeof(buf), "%.0f s", tick); + painter.drawLine(tickLine, 0, tickLine, 30); painter.drawText(tickLine + 2, 25, buf);