Changed endpoints and db queries, chart now shows suggested mins and maxes

This commit is contained in:
Daniel Ledda
2020-11-07 01:21:33 +01:00
parent 607b82272e
commit 9dbe7c0897

View File

@@ -22,9 +22,7 @@
urlEndpoint += "since/" + pathname.slice(pathname.lastIndexOf("/") + 1); urlEndpoint += "since/" + pathname.slice(pathname.lastIndexOf("/") + 1);
} }
const data = await fetch(urlEndpoint); const data = await fetch(urlEndpoint);
const newData = transformData(await data.json()); return transformData(await data.json());
console.log(pathname, newData);
return newData;
} }
async function initChart() { async function initChart() {
@@ -75,8 +73,8 @@
id: 'y-axis-1', id: 'y-axis-1',
ticks: { ticks: {
fontColor: co2Color, fontColor: co2Color,
suggestedMin: 400, min: 400,
suggestedMax: 1100, max: 1100,
}, },
}, { }, {
type: 'linear', type: 'linear',
@@ -85,8 +83,8 @@
id: 'y-axis-2', id: 'y-axis-2',
ticks: { ticks: {
fontColor: tempColor, fontColor: tempColor,
suggestedMin: 10, min: 10,
suggestedMax: 35, max: 35,
}, },
gridLines: { gridLines: {
drawOnChartArea: false, drawOnChartArea: false,
@@ -98,8 +96,8 @@
id: 'y-axis-3', id: 'y-axis-3',
ticks: { ticks: {
fontColor: humidityColor, fontColor: humidityColor,
suggestedMin: 15, min: 15,
suggestedMax: 85, max: 85,
}, },
gridLines: { gridLines: {
drawOnChartArea: false, drawOnChartArea: false,