diff --git a/index.html b/index.html index 84acc3b..d31d7c6 100644 --- a/index.html +++ b/index.html @@ -43,7 +43,7 @@
Loading chart, please wait...
- +
diff --git a/script/script.js b/script/script.js index 38c724b..8edb336 100644 --- a/script/script.js +++ b/script/script.js @@ -170,16 +170,17 @@ d3.csv("PHSwithContinent.csv").then(function(data) { const c = d3.select("#continentSelect").property("value"); const s = d3.select("#sexSelect").property("value"); const e = d3.select("#incomeSelect").property("value"); - + const parts = [ "education_health", c !== "All" ? c : null, s !== "All" ? s : null, e !== "All" ? e.replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : null ].filter(Boolean); - + const filename = parts.join("_") + ".png"; - saveSvgAsPng.saveSvgAsPng(document.querySelector("svg"), filename); + + saveSvgAsPng(document.getElementById("chart"), filename); }); });