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