yippee het werkt
This commit is contained in:
@@ -139,6 +139,12 @@ class DataProcessor {
|
||||
}
|
||||
|
||||
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++) {
|
||||
if (i % 4 == 0){
|
||||
this.graph.timeArray.push(this.data[i].TimeStamp);
|
||||
|
@@ -24,10 +24,10 @@ container.setAttribute("class", "container");
|
||||
const dataTypesContainer = document.createElement("div");
|
||||
dataTypesContainer.setAttribute("class", "data-types");
|
||||
|
||||
const temperatureCheckbox = createCheckBox("temperature", "Temperature");
|
||||
const humidityCheckbox = createCheckBox("humidity", "Humidity");
|
||||
const eco2Checkbox = createCheckBox("eco2", "eCO2");
|
||||
const tvocCheckbox = createCheckBox("tvoc", "TVOC");
|
||||
const temperatureCheckbox = createCheckBox("Temp", "Temperature");
|
||||
const humidityCheckbox = createCheckBox("Humi", "Humidity");
|
||||
const eco2Checkbox = createCheckBox("eCO2", "eCO2");
|
||||
const tvocCheckbox = createCheckBox("TVOC", "TVOC");
|
||||
|
||||
dataTypesContainer.appendChild(temperatureCheckbox.checkbox);
|
||||
dataTypesContainer.appendChild(temperatureCheckbox.checkboxLabel);
|
||||
@@ -55,24 +55,30 @@ filterButton.addEventListener("click", () => {
|
||||
temperatureCheckbox,
|
||||
humidityCheckbox,
|
||||
eco2Checkbox,
|
||||
tvocCheckbox,
|
||||
tvocCheckbox
|
||||
];
|
||||
|
||||
checkboxes.forEach((checkbox) => {
|
||||
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 = [
|
||||
startDate,
|
||||
endDate,
|
||||
selectedNodes,
|
||||
selectedFields
|
||||
formattedString
|
||||
];
|
||||
|
||||
console.log(filteredData);
|
||||
console.log(startDate, endDate, selectedNodes);
|
||||
|
||||
generateLink(startDate, endDate, selectedNodes);
|
||||
generateLink(startDate, endDate, selectedNodes, formattedString);
|
||||
fetchData();
|
||||
});
|
||||
|
||||
@@ -115,7 +121,7 @@ function generateLink(dateStart, dateEnd, node, dataTypes) {
|
||||
const formattedDateStart = new Date(dateStart).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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user