fixed download function
This commit is contained in:
parent
b578c53594
commit
b4642ce57a
1 changed files with 4 additions and 7 deletions
|
|
@ -171,7 +171,6 @@ d3.csv("PHSwithContinent.csv").then(function(data) {
|
||||||
updateChart();
|
updateChart();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Download chart as PNG
|
|
||||||
d3.select("#downloadButton").on("click", function() {
|
d3.select("#downloadButton").on("click", function() {
|
||||||
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");
|
||||||
|
|
@ -186,14 +185,12 @@ d3.csv("PHSwithContinent.csv").then(function(data) {
|
||||||
|
|
||||||
const filename = parts.join("_") + ".png";
|
const filename = parts.join("_") + ".png";
|
||||||
|
|
||||||
saveSvgAsPng(document.getElementById("chart"), {
|
saveSvgAsPng(document.getElementById("chart"), filename, { // <-- filename second, options third
|
||||||
filename: filename,
|
|
||||||
scale: 2,
|
scale: 2,
|
||||||
backgroundColor: darkMode ? "#121212" : "#ffffff"
|
backgroundColor: darkMode ? "#121212" : "#ffffff"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update legend depending on chart type
|
// Update legend depending on chart type
|
||||||
function updateLegend(chartType) {
|
function updateLegend(chartType) {
|
||||||
const legend = d3.select("#legend");
|
const legend = d3.select("#legend");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue