diff options
author | Titta Heikkala <titta.heikkala@qt.io> | 2017-02-17 11:39:00 +0200 |
---|---|---|
committer | Otto Ryynänen <otto.ryynanen@qt.io> | 2017-02-17 11:21:45 +0000 |
commit | 2309013b405ad37a20c4be827eba2b064f5f1644 (patch) | |
tree | 6940c475664c0d96a74782e945639981332cec48 /tradeshow | |
parent | 4a1911326d614da88aabb3baa7c57b808ebbaf99 (diff) |
iot-sensortag: Change Magnetometer chart type
Magnetometer chart changed from polar chart view to chart view. Also
changed the series to LineSeries.
Change-Id: Ibdf2dc1c86e63fd20caa8d3c1a09377ea6de8f4b
Reviewed-by: Otto Ryynänen <otto.ryynanen@qt.io>
Diffstat (limited to 'tradeshow')
-rw-r--r-- | tradeshow/iot-sensortag/mockdataprovider.cpp | 18 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml | 64 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png | bin | 41105 -> 0 bytes | |||
-rw-r--r-- | tradeshow/iot-sensortag/seriesstorage.cpp | 6 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/seriesstorage.h | 6 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/uismall.qrc | 1 |
6 files changed, 37 insertions, 58 deletions
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 Binary files differdeleted file mode 100644 index 314ca99..0000000 --- a/tradeshow/iot-sensortag/resources/small/images/Magnetometer/grid.png +++ /dev/null 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<QSplineSeries *>(xSeries); - m_magnetoY = qobject_cast<QSplineSeries *>(ySeries); - m_magnetoZ = qobject_cast<QSplineSeries *>(zSeries); + m_magnetoX = qobject_cast<QLineSeries *>(xSeries); + m_magnetoY = qobject_cast<QLineSeries *>(ySeries); + m_magnetoZ = qobject_cast<QLineSeries *>(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<QPointF> m_gyroListX; QList<QPointF> 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 @@ <file>resources/small/images/Accelometer/outer_ring.png</file> <file>resources/small/images/AmbientTemperature/temp_ring.png</file> <file>resources/small/images/AmbientTemperature/temp_sensor.png</file> - <file>resources/small/images/Magnetometer/grid.png</file> <file>resources/small/images/Toolbar/Cloud_button_change_active.png</file> <file>resources/small/images/Toolbar/Cloud_icon_settings.png</file> <file>resources/small/images/ObjectTemperature/objTemp_display_obj_blue.png</file> |