More fixes in scrollable energy charts
parent
af532e0268
commit
b32e275f86
|
|
@ -430,7 +430,7 @@ StatsBase {
|
|||
backgroundItem: chartView
|
||||
backgroundRect: Qt.rect(chartView.plotArea.x + toolTip.x, chartView.plotArea.y + toolTip.y, toolTip.width, toolTip.height)
|
||||
|
||||
property int idx: Math.max(0, Math.min(d.config.count - 1, Math.ceil(mouseArea.mouseX * d.config.count / mouseArea.width) - 1))
|
||||
property int idx: visible ? Math.max(0, Math.min(d.config.count - 1, Math.ceil(mouseArea.mouseX * d.config.count / mouseArea.width) - 1)) : 0
|
||||
property date timestamp: root.calculateTimestamp(d.config.startTime(), d.config.sampleRate, d.startOffset + idx)
|
||||
|
||||
visible: (mouseArea.containsMouse || mouseArea.tooltipping) && !mouseArea.dragging
|
||||
|
|
|
|||
|
|
@ -418,6 +418,10 @@ Item {
|
|||
// Add a first point at 0 value
|
||||
series.upperSeries.insert(0, new Date().getTime(), 0)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
chartView.removeSeries(series)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ StatsBase {
|
|||
backgroundItem: chartView
|
||||
backgroundRect: Qt.rect(chartView.plotArea.x + toolTip.x, chartView.plotArea.y + toolTip.y, toolTip.width, toolTip.height)
|
||||
|
||||
property int idx: Math.min(d.config.count -1, Math.max(0, Math.ceil(mouseArea.mouseX * d.config.count / mouseArea.width) - 1))
|
||||
property int idx: visible ? Math.min(d.config.count -1, Math.max(0, Math.ceil(mouseArea.mouseX * d.config.count / mouseArea.width) - 1)) : 0
|
||||
property date timestamp: root.calculateTimestamp(d.config.startTime(), d.config.sampleRate, d.startOffset + idx)
|
||||
|
||||
visible: (mouseArea.containsMouse || mouseArea.tooltipping) && !mouseArea.dragging
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ Item {
|
|||
ActivityIndicator {
|
||||
x: chartView.plotArea.x + (chartView.plotArea.width - width) / 2
|
||||
y: chartView.plotArea.y + (chartView.plotArea.height - height) / 2 + (chartView.plotArea.height / 8)
|
||||
visible: powerBalanceLogs.fetchingData
|
||||
visible: powerBalanceLogs.fetchingData && powerBalanceLogs.get(0).timestamp > d.startTime
|
||||
opacity: .5
|
||||
}
|
||||
Label {
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ Item {
|
|||
ActivityIndicator {
|
||||
x: chartView.plotArea.x + (chartView.plotArea.width - width) / 2
|
||||
y: chartView.plotArea.y + (chartView.plotArea.height - height) / 2 + (chartView.plotArea.height / 8)
|
||||
visible: powerBalanceLogs.fetchingData
|
||||
visible: powerBalanceLogs.fetchingData && powerBalanceLogs.get(0).timestamp > d.startTime
|
||||
opacity: .5
|
||||
}
|
||||
Label {
|
||||
|
|
@ -525,7 +525,7 @@ Item {
|
|||
Component.onCompleted: lowerSeries = selfConsumptionSeries.lowerSeries
|
||||
property XYSeries lowerSeries: null
|
||||
|
||||
property double value: toolTip.entry ? Math.max(0, toolTip.entry.consumption) : 0
|
||||
property double value: toolTip.entry ? Math.min(Math.max(0, toolTip.entry.consumption), -toolTip.entry.production) : 0
|
||||
property bool translate: value >= 1000
|
||||
property double translatedValue: value / (translate ? 1000 : 1)
|
||||
text: qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
||||
|
|
|
|||
|
|
@ -124,7 +124,12 @@ Item {
|
|||
function weeksStart() {
|
||||
var d = new Date();
|
||||
d.setHours(0, 0, 0, 0);
|
||||
d.setDate(d.getDate() - d.getDay() + 1 - (weeksCount - 1) * 7);
|
||||
print("now is:", d, "weeksCount:", weeksCount)
|
||||
// We'll start the week on Monday for now, given that's international ISO standard. For US and Canada we may want to introduce a setting at some point.
|
||||
// JS Date starts on Sunday though, so we'll have to adjust
|
||||
var dayOfWeek = (d.getDay() + 6) % 7
|
||||
print("getDay", d.getDay(), "dayOfWeek", dayOfWeek, "getDate", d.getDate())
|
||||
d.setDate(d.getDate() - dayOfWeek - (weeksCount - 1) * 7);
|
||||
return d
|
||||
}
|
||||
function weekLabel(date) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue