From e2c0f00adb0500421f55ae78e1c6c897a3cf3357 Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Sat, 3 Oct 2020 00:35:37 +0530 Subject: [PATCH] Correctly fill whole width of graph --- src/gui/properties/speedplotview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index b924ae370..26ce80b86 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -271,7 +271,7 @@ quint64 SpeedPlotView::maxYValue() if (!m_properties[static_cast(id)].enable) continue; - for (int i = static_cast(queue.size()) - 1, j = 0; (i >= 0) && (j <= m_viewablePointsCount); --i, ++j) + for (int i = static_cast(queue.size()) - 1, j = 0; (i >= 0) && (j < m_viewablePointsCount); --i, ++j) if (queue[i].y[id] > maxYValue) maxYValue = queue[i].y[id]; } @@ -345,7 +345,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *) rect.adjust(3, 0, 0, 0); // Need, else graphs cross left gridline const double yMultiplier = (niceScale.arg == 0.0) ? 0.0 : (static_cast(rect.height()) / niceScale.sizeInBytes()); - const double xTickSize = static_cast(rect.width()) / m_viewablePointsCount; + const double xTickSize = static_cast(rect.width()) / (m_viewablePointsCount - 1); boost::circular_buffer &queue = getCurrentData(); @@ -354,7 +354,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *) continue; QVector points; - for (int i = static_cast(queue.size()) - 1, j = 0; (i >= 0) && (j <= m_viewablePointsCount); --i, ++j) { + for (int i = static_cast(queue.size()) - 1, j = 0; (i >= 0) && (j < m_viewablePointsCount); --i, ++j) { int newX = rect.right() - j * xTickSize; int newY = rect.bottom() - queue[i].y[id] * yMultiplier;