Update script.js
This commit is contained in:
parent
b4642ce57a
commit
9e3190d759
1 changed files with 3 additions and 1 deletions
|
|
@ -175,9 +175,11 @@ d3.csv("PHSwithContinent.csv").then(function(data) {
|
||||||
const c = d3.select("#continentSelect").property("value");
|
const c = d3.select("#continentSelect").property("value");
|
||||||
const s = d3.select("#sexSelect").property("value");
|
const s = d3.select("#sexSelect").property("value");
|
||||||
const e = d3.select("#incomeSelect").property("value");
|
const e = d3.select("#incomeSelect").property("value");
|
||||||
|
const chartType = d3.select("#chartTypeSelect").property("value"); // 🆕 Get selected chart type
|
||||||
|
|
||||||
const parts = [
|
const parts = [
|
||||||
"education_health",
|
"education_health",
|
||||||
|
chartType, // 🆕 Add chart type into the filename
|
||||||
c !== "All" ? c : null,
|
c !== "All" ? c : null,
|
||||||
s !== "All" ? s : null,
|
s !== "All" ? s : null,
|
||||||
e !== "All" ? e.replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : null
|
e !== "All" ? e.replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : null
|
||||||
|
|
@ -185,7 +187,7 @@ d3.csv("PHSwithContinent.csv").then(function(data) {
|
||||||
|
|
||||||
const filename = parts.join("_") + ".png";
|
const filename = parts.join("_") + ".png";
|
||||||
|
|
||||||
saveSvgAsPng(document.getElementById("chart"), filename, { // <-- filename second, options third
|
saveSvgAsPng(document.getElementById("chart"), filename, {
|
||||||
scale: 2,
|
scale: 2,
|
||||||
backgroundColor: darkMode ? "#121212" : "#ffffff"
|
backgroundColor: darkMode ? "#121212" : "#ffffff"
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue