AmCharts 4 - How to set the name of the export when using the API?

Viewed 504

I have this:

this.config = {};
this.chartId = 'myId';
this.chartType = am4charts.PieChart;

this.chart = am4core.createFromConfig(
  {
    this.config,
    this.chartId,
    this.chartType
  }
);

then do:

this.chart.exporting.export('png');

The name of the export file is set by default to "amCharts.png". How can I set the name to something else?

I tried the following without success:

this.config = { export: { fileName: 'yay' } };
this.config = { fileName: 'yay' };
1 Answers

Well, it turns out to be as easy as:

this.chart.exporting.filePrefix = 'yay';
this.chart.exporting.export('png');
Related