I want to change the filename while export from amcharts graph download option. Currently it was downloading with name amcharts.jpg or amcharts.pdf.
Kindly assists.
Thanks in advance
You can change the filename by setting the fileName
property, as indicated in the export plugin documentation.
var chart = AmCharts.makeChart("chartdiv", {
// ...
"export": {
"enabled": true,
"fileName": "your new file name without extension",
// ...
}
});
You can also set the fileName
at the format level through the menuReviver
callback. You can use this to override the top level fileName
property depending on the format.
var chart = AmCharts.makeChart("chartdiv", {
// ...
"export": {
"enabled": true,
"fileName": "top level filename",
"menuReviver": function(item, li) {
if (item.format === "JPG") {
item.fileName = "customJPGName"; //different file name for JPG files
}
return li;
}
}
});