yippee het werkt
This commit is contained in:
@@ -139,6 +139,12 @@ class DataProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateGraph() {
|
updateGraph() {
|
||||||
|
this.graph.timeArray = [];
|
||||||
|
this.graph.tempArray = [];
|
||||||
|
this.graph.humiArray = [];
|
||||||
|
this.graph.eco2Array = [];
|
||||||
|
this.graph.tvocArray = [];
|
||||||
|
|
||||||
for (let i = 0; i < this.data.length; i++) {
|
for (let i = 0; i < this.data.length; i++) {
|
||||||
if (i % 4 == 0){
|
if (i % 4 == 0){
|
||||||
this.graph.timeArray.push(this.data[i].TimeStamp);
|
this.graph.timeArray.push(this.data[i].TimeStamp);
|
||||||
|
@@ -24,10 +24,10 @@ container.setAttribute("class", "container");
|
|||||||
const dataTypesContainer = document.createElement("div");
|
const dataTypesContainer = document.createElement("div");
|
||||||
dataTypesContainer.setAttribute("class", "data-types");
|
dataTypesContainer.setAttribute("class", "data-types");
|
||||||
|
|
||||||
const temperatureCheckbox = createCheckBox("temperature", "Temperature");
|
const temperatureCheckbox = createCheckBox("Temp", "Temperature");
|
||||||
const humidityCheckbox = createCheckBox("humidity", "Humidity");
|
const humidityCheckbox = createCheckBox("Humi", "Humidity");
|
||||||
const eco2Checkbox = createCheckBox("eco2", "eCO2");
|
const eco2Checkbox = createCheckBox("eCO2", "eCO2");
|
||||||
const tvocCheckbox = createCheckBox("tvoc", "TVOC");
|
const tvocCheckbox = createCheckBox("TVOC", "TVOC");
|
||||||
|
|
||||||
dataTypesContainer.appendChild(temperatureCheckbox.checkbox);
|
dataTypesContainer.appendChild(temperatureCheckbox.checkbox);
|
||||||
dataTypesContainer.appendChild(temperatureCheckbox.checkboxLabel);
|
dataTypesContainer.appendChild(temperatureCheckbox.checkboxLabel);
|
||||||
@@ -55,24 +55,30 @@ filterButton.addEventListener("click", () => {
|
|||||||
temperatureCheckbox,
|
temperatureCheckbox,
|
||||||
humidityCheckbox,
|
humidityCheckbox,
|
||||||
eco2Checkbox,
|
eco2Checkbox,
|
||||||
tvocCheckbox,
|
tvocCheckbox
|
||||||
];
|
];
|
||||||
|
|
||||||
checkboxes.forEach((checkbox) => {
|
checkboxes.forEach((checkbox) => {
|
||||||
if (checkbox.checkbox.checked) {
|
if (checkbox.checkbox.checked) {
|
||||||
selectedFields.push(checkbox.checkbox.id);
|
selectedFields.push(String(checkbox.checkbox.id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let selectedFieldsString = selectedFields.map(String);
|
||||||
|
|
||||||
|
let formattedString = '(' + selectedFieldsString.map(item => `'${item}'`).join(', ') + ')';
|
||||||
|
|
||||||
const filteredData = [
|
const filteredData = [
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
selectedNodes,
|
selectedNodes,
|
||||||
selectedFields
|
formattedString
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log(filteredData);
|
console.log(filteredData);
|
||||||
console.log(startDate, endDate, selectedNodes);
|
console.log(startDate, endDate, selectedNodes);
|
||||||
|
|
||||||
generateLink(startDate, endDate, selectedNodes);
|
generateLink(startDate, endDate, selectedNodes, formattedString);
|
||||||
fetchData();
|
fetchData();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,7 +121,7 @@ function generateLink(dateStart, dateEnd, node, dataTypes) {
|
|||||||
const formattedDateStart = new Date(dateStart).toISOString().replace('T', '%20');
|
const formattedDateStart = new Date(dateStart).toISOString().replace('T', '%20');
|
||||||
const formattedDateEnd = new Date(dateEnd).toISOString().replace('T', '%20');
|
const formattedDateEnd = new Date(dateEnd).toISOString().replace('T', '%20');
|
||||||
|
|
||||||
link = `${baseUrl}?dateStart=${formattedDateStart}&dateEnd=${formattedDateEnd}&node=${node}&dataTypes=${dataTypes}`;
|
link = `${baseUrl}?dateStart=${formattedDateStart}&dateEnd=${formattedDateEnd}&node=${node}&dataType=${dataTypes}`;
|
||||||
|
|
||||||
console.log(link);
|
console.log(link);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user