diff --git a/Modules/energy/package/contents/ui/Graph.qml b/Modules/energy/package/contents/ui/Graph.qml --- a/Modules/energy/package/contents/ui/Graph.qml +++ b/Modules/energy/package/contents/ui/Graph.qml @@ -66,7 +66,7 @@ //take a QPointF function scalePoint(plot, currentUnixTime) { - var scaledX = (plot.x - (currentUnixTime / 1000 - xDuration)) / xDuration * plotWidth + var scaledX = (plot.x - (currentUnixTime / 1000 - xDuration)) / xDuration * plotWidth; var scaledY = (plot.y - yMin) * plotHeight / (yMax - yMin); return Qt.point(xPadding + scaledX, @@ -111,7 +111,7 @@ var index = 0 - while (data[index].x < (xMinUnixTime / 1000)) { + while ((index < data.length - 1) && (data[index].x < (xMinUnixTime / 1000))) { index++ } diff --git a/Modules/energy/package/contents/ui/main.qml b/Modules/energy/package/contents/ui/main.qml --- a/Modules/energy/package/contents/ui/main.qml +++ b/Modules/energy/package/contents/ui/main.qml @@ -293,7 +293,10 @@ yMax: { if (root.historyType == HistoryModel.RateType) { // ceil to nearest 10 - return Math.floor(history.largestValue) + 10 + var max = Math.floor(history.largestValue) + max = max - max % 10 + 10 + + return max; } else { return 100; }