From 2309013b405ad37a20c4be827eba2b064f5f1644 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Fri, 17 Feb 2017 11:39:00 +0200 Subject: iot-sensortag: Change Magnetometer chart type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Magnetometer chart changed from polar chart view to chart view. Also changed the series to LineSeries. Change-Id: Ibdf2dc1c86e63fd20caa8d3c1a09377ea6de8f4b Reviewed-by: Otto Ryynänen --- tradeshow/iot-sensortag/mockdataprovider.cpp | 18 +++--- .../resources/base/MagnetometerChart.qml | 64 +++++++-------------- .../resources/small/images/Magnetometer/grid.png | Bin 41105 -> 0 bytes tradeshow/iot-sensortag/seriesstorage.cpp | 6 +- tradeshow/iot-sensortag/seriesstorage.h | 6 +- tradeshow/iot-sensortag/uismall.qrc | 1 - 6 files changed, 37 insertions(+), 58 deletions(-) delete mode 100644 tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png (limited to 'tradeshow') diff --git a/tradeshow/iot-sensortag/mockdataprovider.cpp b/tradeshow/iot-sensortag/mockdataprovider.cpp index 075b308..0324d98 100644 --- a/tradeshow/iot-sensortag/mockdataprovider.cpp +++ b/tradeshow/iot-sensortag/mockdataprovider.cpp @@ -195,15 +195,15 @@ void MockDataProvider::rapidTimerExpired() accelometerZ = 1; } emit accelometerChanged(); - magnetometerMicroT_xAxis += 50; - magnetometerMicroT_yAxis += 50; - magnetometerMicroT_zAxis += 50; - if (magnetometerMicroT_xAxis > 1000) - magnetometerMicroT_xAxis -= 1000; - if (magnetometerMicroT_yAxis > 1000) - magnetometerMicroT_yAxis -= 1000; - if (magnetometerMicroT_zAxis > 1000) - magnetometerMicroT_zAxis -= 1000; + magnetometerMicroT_xAxis += 100; + magnetometerMicroT_yAxis += 100; + magnetometerMicroT_zAxis += 100; + if (magnetometerMicroT_xAxis > 1500) + magnetometerMicroT_xAxis -= 3000; + if (magnetometerMicroT_yAxis > 1500) + magnetometerMicroT_yAxis -= 3000; + if (magnetometerMicroT_zAxis > 1500) + magnetometerMicroT_zAxis -= 3000; emit magnetometerMicroTChanged(); rotation_x += 1; diff --git a/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml b/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml index 3bac8e6..29458f6 100644 --- a/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml +++ b/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml @@ -58,9 +58,9 @@ BaseChart { property int maxNumOfMagnReadings: 24 readonly property color chartColor: "#15bdff" - readonly property string xColor: "#15bdff" + readonly property string xColor: "#4db300" readonly property string yColor: "white" - readonly property string zColor: "red" + readonly property string zColor: "#f64405" readonly property color textColor: "white" title: qsTr("Magnetometer") @@ -77,31 +77,23 @@ BaseChart { } } - Image { - anchors.fill: parent - source: pathPrefix + "Magnetometer/grid.png" - } - Glow { anchors.fill: chartView radius: 18 samples: 30 - color: "red" + color: zColor source: chartView } - - PolarChartView { + ChartView { id: chartView anchors.top: parent.top - anchors.topMargin: -8 anchors.bottom: parent.bottom - anchors.bottomMargin: -10 + anchors.bottomMargin: 25 anchors.left: parent.left - anchors.leftMargin: -60 + anchors.leftMargin: -20 anchors.right: parent.right - anchors.rightMargin: 30 antialiasing: true backgroundColor: "transparent" legend.visible: false @@ -112,19 +104,18 @@ BaseChart { ValueAxis { id: valueAxisX min: 0 - max: maxNumOfMagnReadings + max: maxNumOfMagnReadings + 1 visible: false } ValueAxis { id: valueAxisY - - min: -1000 - max: 1000 + min: -2000 + max: 2000 visible: false } - SplineSeries { + LineSeries { id: magnSeriesX axisX: valueAxisX axisY: valueAxisY @@ -132,7 +123,7 @@ BaseChart { name: "Magnet X" useOpenGL: true } - SplineSeries { + LineSeries { id: magnSeriesY axisX: valueAxisX axisY: valueAxisY @@ -140,7 +131,7 @@ BaseChart { name: "Magnet Y" useOpenGL: true } - SplineSeries { + LineSeries { id: magnSeriesZ axisX: valueAxisX axisY: valueAxisY @@ -150,34 +141,24 @@ BaseChart { } } - Column { - id: labelColumn + Row { + id: labelRow anchors.fill: parent - anchors.rightMargin: 20 + anchors.leftMargin: 16 Repeater { model: 3 Item { - height: labelColumn.height / 3 - width: labelColumn.width + height: labelRow.height + width: labelRow.width / 3 Text { id: coordText text: (index == 0) ? "X" : ((index == 1) ? "Y" : "Z") - color: "white" - anchors.right: parent.right - anchors.top: parent.top - horizontalAlignment: Text.AlignRight - width: contentWidth - } - - Rectangle { color: (index == 0) ? xColor : ((index == 1) ? yColor : zColor) - anchors.right: parent.right - anchors.top: coordText.bottom - height: 1 - width: parent.width / 8 + anchors.left: parent.left + anchors.bottom: parent.bottom } Text { @@ -186,10 +167,9 @@ BaseChart { sensor.magnetometerMicroT_zAxis) ) : "" color: "white" - anchors.right: parent.right - anchors.top: coordText.bottom - horizontalAlignment: Text.AlignRight - width: contentWidth + anchors.left: coordText.right + anchors.leftMargin: 16 + anchors.bottom: parent.bottom } } } diff --git a/tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png b/tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png deleted file mode 100644 index 314ca99..0000000 Binary files a/tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png and /dev/null differ diff --git a/tradeshow/iot-sensortag/seriesstorage.cpp b/tradeshow/iot-sensortag/seriesstorage.cpp index 54ac977..556499c 100644 --- a/tradeshow/iot-sensortag/seriesstorage.cpp +++ b/tradeshow/iot-sensortag/seriesstorage.cpp @@ -87,9 +87,9 @@ void SeriesStorage::setGyroSeries(QAbstractSeries *xSeries, QAbstractSeries *ySe void SeriesStorage::setMagnetoMeterSeries(QAbstractSeries *xSeries, QAbstractSeries *ySeries, QAbstractSeries *zSeries) { - m_magnetoX = qobject_cast(xSeries); - m_magnetoY = qobject_cast(ySeries); - m_magnetoZ = qobject_cast(zSeries); + m_magnetoX = qobject_cast(xSeries); + m_magnetoY = qobject_cast(ySeries); + m_magnetoZ = qobject_cast(zSeries); } void SeriesStorage::dataProviderPoolChanged() diff --git a/tradeshow/iot-sensortag/seriesstorage.h b/tradeshow/iot-sensortag/seriesstorage.h index 343c65e..3f6d459 100644 --- a/tradeshow/iot-sensortag/seriesstorage.h +++ b/tradeshow/iot-sensortag/seriesstorage.h @@ -84,9 +84,9 @@ private: QSplineSeries *m_gyroX{0}; QSplineSeries *m_gyroY{0}; QSplineSeries *m_gyroZ{0}; - QSplineSeries *m_magnetoX{0}; - QSplineSeries *m_magnetoY{0}; - QSplineSeries *m_magnetoZ{0}; + QLineSeries *m_magnetoX{0}; + QLineSeries *m_magnetoY{0}; + QLineSeries *m_magnetoZ{0}; QLineSeries *m_temperature{0}; QList m_gyroListX; QList m_gyroListY; diff --git a/tradeshow/iot-sensortag/uismall.qrc b/tradeshow/iot-sensortag/uismall.qrc index 56dd9d7..1d18373 100644 --- a/tradeshow/iot-sensortag/uismall.qrc +++ b/tradeshow/iot-sensortag/uismall.qrc @@ -13,7 +13,6 @@ resources/small/images/Accelometer/outer_ring.png resources/small/images/AmbientTemperature/temp_ring.png resources/small/images/AmbientTemperature/temp_sensor.png - resources/small/images/Magnetometer/grid.png resources/small/images/Toolbar/Cloud_button_change_active.png resources/small/images/Toolbar/Cloud_icon_settings.png resources/small/images/ObjectTemperature/objTemp_display_obj_blue.png -- cgit v1.2.3