Commit cce7c905 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Use updateRateLimit in the Line chart face

A little trickier this time since we need to account for the update rate
in the history source.
parent 8fed989e
......@@ -127,6 +127,7 @@ Faces.SensorFace {
chart: compactRepresentation
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
sensorIds: root.showLegend ? root.controller.lowPrioritySensorIds : []
updateRateLimit: root.controller.updateRateLimit
}
}
}
......@@ -31,8 +31,6 @@ import org.kde.quickcharts 1.0 as Charts
Charts.LineChart {
id: chart
//property var sensors: root.controller.highPrioritySensorIds
property var controller
readonly property alias sensorsModel: sensorsModel
......@@ -58,6 +56,8 @@ Charts.LineChart {
Sensors.SensorDataModel {
id: sensorsModel
sensors: chart.controller.highPrioritySensorIds
updateRateLimit: chart.controller.updateRateLimit
property double stackedMaximum: yRange.stackedAuto ? calcStackedMaximum() : 0
function calcStackedMaximum() {
......@@ -86,15 +86,34 @@ Charts.LineChart {
Instantiator {
model: sensorsModel.sensors
delegate: Charts.HistoryProxySource {
id: history
source: Charts.ModelSource {
model: sensorsModel
column: index
roleName: "Value"
}
interval: sensorsModel.ready ? sensorsModel.headerData(index, Qt.Horizontal, Sensors.SensorDataModel.UpdateInterval) : 0
interval: {
if (chart.controller.updateRateLimit > 0) {
return chart.controller.updateRateLimit
}
if (sensorsModel.ready) {
return sensorsModel.headerData(index, Qt.Horizontal, Sensors.SensorDataModel.UpdateInterval)
}
return 0
}
maximumHistory: interval > 0 ? (chart.historyAmount * 1000) / interval : 0
fillMode: Charts.HistoryProxySource.FillFromEnd
property var connection: Connections {
target: chart.controller
function onUpdateRateLimitChanged() {
history.clear()
}
}
}
onObjectAdded: {
chart.insertValueSource(index, object)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment