done untill histogram
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user