From dd8480cb8985d91d2cd99ca4741a4d8789eec700 Mon Sep 17 00:00:00 2001 From: dodoradio Date: Sat, 22 Jul 2023 16:28:44 +0100 Subject: lineGraph: add support for floating point values It seems that floats weren't previously supported due to a programming error on my part --- src/cpp/lineGraph.cpp | 8 ++++---- src/cpp/lineGraph.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/cpp') diff --git a/src/cpp/lineGraph.cpp b/src/cpp/lineGraph.cpp index 7e013be..36171b9 100644 --- a/src/cpp/lineGraph.cpp +++ b/src/cpp/lineGraph.cpp @@ -83,13 +83,13 @@ void LineGraph::loadGraphData(QVariant fileDataInput) { return; } int j = fileDataAsList.count(); - minTime = fileDataAsList[0].toPoint().x(); - maxTime = fileDataAsList[j-1].toPoint().x(); - minValue = fileDataAsList[0].toPoint().y(); + minTime = fileDataAsList[0].toPointF().x(); + maxTime = fileDataAsList[j-1].toPointF().x(); + minValue = fileDataAsList[0].toPointF().y(); maxValue = minValue; m_filedata.clear(); for(int i = 0; i < j; i++) { - m_filedata.append(fileDataAsList[i].toPoint()); + m_filedata.append(fileDataAsList[i].toPointF()); if (minValue > m_filedata[i].y()) minValue = m_filedata[i].y(); if (maxValue < m_filedata[i].y()) maxValue = m_filedata[i].y(); } diff --git a/src/cpp/lineGraph.h b/src/cpp/lineGraph.h index 4ee4655..f6a592c 100644 --- a/src/cpp/lineGraph.h +++ b/src/cpp/lineGraph.h @@ -76,8 +76,8 @@ private: QColor m_color = QColor(255,255,255); QPixmap m_pixmap; QList m_filedata; - int minValue = 0; - int maxValue = 0; + float minValue = 0; + float maxValue = 0; int minTime; int maxTime; bool graphRelative; -- cgit v1.2.3-70-g09d2