fixed export png function
This commit is contained in:
parent
e10e838745
commit
93ecc88ade
2 changed files with 5 additions and 4 deletions
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
<div id="loading">Loading chart, please wait...</div>
|
<div id="loading">Loading chart, please wait...</div>
|
||||||
|
|
||||||
<svg width="1400" height="600"></svg>
|
<svg id="chart" width="1400" height="600"></svg>
|
||||||
|
|
||||||
<div class="legend" id="legend"></div>
|
<div class="legend" id="legend"></div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,16 +170,17 @@ 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 parts = [
|
const parts = [
|
||||||
"education_health",
|
"education_health",
|
||||||
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
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
const filename = parts.join("_") + ".png";
|
const filename = parts.join("_") + ".png";
|
||||||
saveSvgAsPng.saveSvgAsPng(document.querySelector("svg"), filename);
|
|
||||||
|
saveSvgAsPng(document.getElementById("chart"), filename);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue