This commit is contained in:
=
2026-03-20 17:34:07 +10:00
parent 49d5a4dadd
commit 718fbbc0ef
4 changed files with 49 additions and 14 deletions

View File

@@ -16,15 +16,18 @@ document.addEventListener("DOMContentLoaded", function () {
clearGraph();
updateGraph();
});
document.querySelectorAll("[name=\"OY\"]").forEach((x) => {
x.addEventListener("click", () => { d3.select("#drawButton").attr("class", getOY().length == 0 ? "error" : ""); })
})
});
function updateGraph() {
const keyX = ["Год","Страна"][getOX()];
const keyX = ["Год", "Страна"][getOX()];
const yAxis = getOY();
errorDisplay.hidden = yAxis.length!=0
drawGraph(buildings,keyX, yAxis.includes(0),yAxis.includes(1));
d3.select("#drawButton").attr("class", yAxis.length == 0 ? "error" : "");
drawGraph(buildings, keyX, yAxis.includes(0), yAxis.includes(1), getGraphType());
}
@@ -38,6 +41,10 @@ function getOY() {
(x) => Number(x.value));
}
function clearGraph(){
function clearGraph() {
d3.select("svg").selectAll('*').remove();
}
function getGraphType() {
return Number(graphType.value);
}