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 real xTicksAtDontCare: 0 | ||||
253 | readonly property real xTicksAtTwelveOClock: 1 | ||||
254 | readonly property real xTicksAtFullHour: 2 | ||||
255 | readonly property real xTicksAtHalfHour: 3 | ||||
256 | readonly property real xTicksAtFullSecondHour: 4 | ||||
257 | readonly property real xTicksAtTenMinutes: 5 | ||||
258 | readonly property var xTicksAtList: [xTicksAtTenMinutes, xTicksAtHalfHour, xTicksAtHalfHour, | ||||
259 | xTicksAtFullHour, xTicksAtFullSecondHour, xTicksAtTwelveOClock] | ||||
260 | | ||||
261 | // Set grid lines distances which directly correspondent to the xTicksAt variables | ||||
262 | readonly property var xDivisionWidths: [1000 * 60 * 10, 1000 * 60 * 60 * 12, 1000 * 60 * 60, 1000 * 60 * 30, 1000 * 60 * 60 * 2, 1000 * 60 * 10] | ||||
263 | xTicksAt: xTicksAtList[timespanCombo.currentIndex] | ||||
264 | xDivisionWidth: xDivisionWidths[xTicksAt] | ||||
265 | | ||||
252 | xMin: history.firstDataPointTime | 266 | xMin: history.firstDataPointTime | ||
253 | xMax: history.lastDataPointTime | 267 | xMax: history.lastDataPointTime | ||
268 | xDuration: history.duration | ||||
254 | 269 | | |||
255 | yUnits: root.historyType == HistoryModel.RateType ? i18nc("Shorthand for Watts","W") : i18nc("literal percent sign","%") | 270 | yUnits: root.historyType == HistoryModel.RateType ? i18nc("Shorthand for Watts","W") : i18nc("literal percent sign","%") | ||
256 | yMax: { | 271 | yMax: { | ||
257 | if (root.historyType == HistoryModel.RateType) { | 272 | if (root.historyType == HistoryModel.RateType) { | ||
258 | var max = history.largestValue | 273 | var max = history.largestValue | ||
259 | var modulo = max % 10 | 274 | var modulo = max % 10 | ||
260 | if (modulo > 0) { | 275 | if (modulo > 0) { | ||
261 | max = max - modulo + 10 // ceil to nearest 10s | 276 | max = max - modulo + 10 // ceil to nearest 10s | ||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |