Fixed the range of the lights graph y axis (255 before 100 max after)

This commit is contained in:
Kai Lauterbach 2023-05-07 09:45:18 +02:00
parent 120a0e3efd
commit ba63edfc5f
2 changed files with 13 additions and 10 deletions

View file

@ -13,6 +13,7 @@ tabTDE.classList.remove("visible");
amain.classList.add("pure-button-primary");
acfg.classList.remove("pure-button-primary");
atde.classList.remove("pure-button-primary");
loadGraphData();
});
acfg.addEventListener("click", function() {
tabMain.classList.remove("visible");
@ -50,10 +51,10 @@ var channel3 = [];
var channel4 = [];
for (var i = 0; i < data['tcdata'].length; i++) {
time.push(data['tcdata'][i]['hour'] + ':' + (data['tcdata'][i]['min'] < 10 ? '0' : '') + data['tcdata'][i]['min']);
channel1.push(data['tcdata'][i]['ch1']);
channel2.push(data['tcdata'][i]['ch2']);
channel3.push(data['tcdata'][i]['ch3']);
channel4.push(data['tcdata'][i]['ch4']);
channel1.push(data['tcdata'][i]['ch1'] * 100 / 255);
channel2.push(data['tcdata'][i]['ch2'] * 100 / 255);
channel3.push(data['tcdata'][i]['ch3'] * 100 / 255);
channel4.push(data['tcdata'][i]['ch4'] * 100 / 255);
}
currenttime.push(data['currenttime']['hour']);
currenttime.push(data['currenttime']['min']);
@ -130,7 +131,7 @@ tickangle: -45,
},
yaxis: {
title: 'Brightness',
range: [0, 255],
range: [0, 100],
},
shapes: [{
type: 'line',

View file

@ -19,6 +19,8 @@ function addTabListener() {
amain.classList.add("pure-button-primary");
acfg.classList.remove("pure-button-primary");
atde.classList.remove("pure-button-primary");
loadGraphData(); // reload the graph
});
acfg.addEventListener("click", function() {
@ -64,10 +66,10 @@ function loadGraphData() {
var channel4 = [];
for (var i = 0; i < data['tcdata'].length; i++) {
time.push(data['tcdata'][i]['hour'] + ':' + (data['tcdata'][i]['min'] < 10 ? '0' : '') + data['tcdata'][i]['min']);
channel1.push(data['tcdata'][i]['ch1']);
channel2.push(data['tcdata'][i]['ch2']);
channel3.push(data['tcdata'][i]['ch3']);
channel4.push(data['tcdata'][i]['ch4']);
channel1.push(data['tcdata'][i]['ch1'] * 100 / 255);
channel2.push(data['tcdata'][i]['ch2'] * 100 / 255);
channel3.push(data['tcdata'][i]['ch3'] * 100 / 255);
channel4.push(data['tcdata'][i]['ch4'] * 100 / 255);
}
currenttime.push(data['currenttime']['hour']);
currenttime.push(data['currenttime']['min']);
@ -155,7 +157,7 @@ function loadGraphData() {
},
yaxis: {
title: 'Brightness',
range: [0, 255],
range: [0, 100],
},
shapes: [{
type: 'line',