Reputation: 43
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
Upvotes: 0
Views: 4231
Reputation: 766
Or you can do something like this:
var chart = am4core.create("Any chartname", am4charts.XYChart3D);
chart.exporting.menu = new am4core.ExportMenu();
chart.exporting.filePrefix = "The exporting file name";
Upvotes: 1
Reputation: 91
create an amChart and prefix the chart with preferred file name
chart: any;
this.chart = am4core.create('core-chart', am4charts.XYChart);
this.chart.exporting.filePrefix = "preferred file name";
Upvotes: 1
Reputation: 16012
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;
}
}
});
Upvotes: 5