Changeset View
Changeset View
Standalone View
Standalone View
Modules/energy/package/contents/ui/main.qml
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Line(s) | 243 | Graph { | |||
---|---|---|---|---|---|
244 | id: graph | 244 | id: graph | ||
245 | Layout.fillWidth: true | 245 | Layout.fillWidth: true | ||
246 | Layout.minimumHeight: column.width / 3 | 246 | Layout.minimumHeight: column.width / 3 | ||
247 | Layout.maximumHeight: column.width / 3 | 247 | Layout.maximumHeight: column.width / 3 | ||
248 | Layout.topMargin: units.largeSpacing | 248 | Layout.topMargin: units.largeSpacing | ||
249 | 249 | | |||
250 | data: history.points | 250 | data: history.points | ||
251 | 251 | | |||
252 | readonly property var xDivisionWidths: [1000*60*10, 1000*60*30, 1000*60*60, 1000*60*60, 1000*60*60*2, 1000*60*60*24] | ||||
253 | readonly property real xTicksAtDontCare: 0 | ||||
254 | readonly property real xTicksAtTwelveOClock: 1 | ||||
255 | readonly property real xTicksAtFullHour: 2 | ||||
256 | readonly property real xTicksAtHalfHour: 3 | ||||
257 | readonly property var xTicksAtList: [xTicksAtDontCare, xTicksAtHalfHour, xTicksAtHalfHour, xTicksAtHalfHour, xTicksAtFullHour, xTicksAtTwelveOClock] | ||||
258 | | ||||
259 | xDivisionWidth: xDivisionWidths[timespanCombo.currentIndex] | ||||
260 | xTicksAt: xTicksAtList[timespanCombo.currentIndex] | ||||
261 | | ||||
252 | xMin: history.firstDataPointTime | 262 | xMin: history.firstDataPointTime | ||
253 | xMax: history.lastDataPointTime | 263 | xMax: history.lastDataPointTime | ||
264 | xDuration: history.duration | ||||
254 | 265 | | |||
255 | yUnits: root.historyType == HistoryModel.RateType ? i18nc("Shorthand for Watts","W") : i18nc("literal percent sign","%") | 266 | yUnits: root.historyType == HistoryModel.RateType ? i18nc("Shorthand for Watts","W") : i18nc("literal percent sign","%") | ||
256 | yMax: { | 267 | yMax: { | ||
257 | if (root.historyType == HistoryModel.RateType) { | 268 | if (root.historyType == HistoryModel.RateType) { | ||
258 | var max = history.largestValue | 269 | var max = history.largestValue | ||
259 | var modulo = max % 10 | 270 | var modulo = max % 10 | ||
260 | if (modulo > 0) { | 271 | if (modulo > 0) { | ||
261 | max = max - modulo + 10 // ceil to nearest 10s | 272 | max = max - modulo + 10 // ceil to nearest 10s | ||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |