Skip to content

Commit

Permalink
0.8.121
Browse files Browse the repository at this point in the history
* fix plot of history graph #1635
  • Loading branch information
lumapu committed May 20, 2024
1 parent 267d2da commit 6b79146
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.8.121 - 2024-05-20
* fix ESP32 factory image generation
* fix plot of history graph #1635

## 0.8.120 - 2024-05-18
* fix crash if invalid serial number was set -> inverter will be disabled automatically
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 120
#define VERSION_PATCH 121
//-------------------------------------
typedef struct {
uint8_t ch;
Expand Down
20 changes: 8 additions & 12 deletions src/web/html/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ <h4 style="margin-bottom:0px;">Insert data into Yield per day history</h4>
function calcScale(obj) {
let s = {}
s.x_mul = 60
s.ts_start = obj.lastValueTs - (obj.refresh * obj.value.length)
s.ts_dur = obj.lastValueTs - s.ts_start
s.ts_pad = (s.ts_dur < 1800) ? 0 : s.ts_start % 1800
s.ts_dur += s.ts_pad
s.ts_dur = obj.refresh * obj.value.length
s.ts_start = obj.lastValueTs - s.ts_dur
while(s.x_mul * 10 <= s.ts_dur)
s.x_mul += (s.x_mul == 60) ? 240 : ((s.x_mul < 1800) ? 300 : 1800)
s.x_step = Math.ceil(s.ts_dur / s.x_mul)

s.y_mul = 10
while(s.y_mul * 10 <= obj.max)
Expand Down Expand Up @@ -91,8 +88,8 @@ <h4 style="margin-bottom:0px;">Insert data into Yield per day history</h4>
}
div = x2 / scale.ts_dur
for(let i = 0; i < scale.ts_dur; i++) {
if(i % scale.x_mul == 0) {
let d = new Date((scale.ts_start - scale.ts_pad + i) * 1000)
if((i + scale.ts_start) % scale.x_mul == 0) {
let d = new Date((scale.ts_start + i) * 1000)
g.push(mlNs("text", {x: (i*div)+17, y: height+20}, ("0"+d.getHours()).slice(-2) + ":" + ("0"+d.getMinutes()).slice(-2)))
}
}
Expand All @@ -107,7 +104,7 @@ <h4 style="margin-bottom:0px;">Insert data into Yield per day history</h4>
}
div = x2 / scale.ts_dur
for(let i = 0; i <= scale.ts_dur; i++) {
if(i % scale.x_mul == 0) {
if((i + scale.ts_start) % scale.x_mul == 0) {
g.push(mlNs("line", {x1: (i*div), x2: (i*div), y1: 0, y2: height, "stroke-width": 1, "stroke-dasharray": "1,3", stroke: "#aaa"}))
}
}
Expand All @@ -118,16 +115,15 @@ <h4 style="margin-bottom:0px;">Insert data into Yield per day history</h4>
let pts = ""
let i = 0, first = -1, last = -1, lastVal = 0
let div = scale.y_max / height
let xOff = x2 / scale.ts_dur * scale.ts_pad
if(div == 0)
div = 1
for (val of obj.value) {
if(val > 0) {
lastVal = val
pts += " " + String(i + xOff) + "," + String(height - val / div)
pts += " " + String(i) + "," + String(height - val / div)
if(first < 0)
first = i + xOff
last = i + xOff
first = i
last = i
}
i += 2
}
Expand Down

0 comments on commit 6b79146

Please sign in to comment.