done untill histogram

This commit is contained in:
=
2026-03-20 14:40:05 +10:00
parent c368e1eef8
commit 49d5a4dadd
4 changed files with 140 additions and 8 deletions

View File

@@ -11,5 +11,33 @@ document.addEventListener("DOMContentLoaded", function () {
}
tableIsDisplayed = !tableIsDisplayed;
})
updateGraph();
drawButton.addEventListener("click", () => {
clearGraph();
updateGraph();
});
})
});
function updateGraph() {
const keyX = ["Год","Страна"][getOX()];
const yAxis = getOY();
errorDisplay.hidden = yAxis.length!=0
drawGraph(buildings,keyX, yAxis.includes(0),yAxis.includes(1));
}
function getOX() {
return Number(document.querySelector("input[name=\"OX\"]:checked").value);
}
function getOY() {
return d3.map(document.querySelectorAll("input[name=\"OY\"]:checked"),
(x) => Number(x.value));
}
function clearGraph(){
d3.select("svg").selectAll('*').remove();
}