问题
I'm using AmCharts4 and I want to export chart data in CSV, XLSX and JSON format.
I'm including the following scripts in index.html:
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
in .ts file:
...
import * as am4core from "@amcharts/amcharts4/core";
...
let chart4 = am4core.create("chartdiv4", am4charts.XYChart);
chart4.exporting.menu = new am4core.ExportMenu();
and I'm not getting all the options for data export: options that are provided are HTML and PDF
What can cause this?
Thanks, Biljana
回答1:
I've managed to solve this.
The chart's data property needs to be populated and after that you will need to assign an instance of ExportMenu
to the chart's exporting.menu
property.
If data happens to be empty, equal to []
, then the Data menu item of the exporting menu will be missing.
来源:https://stackoverflow.com/questions/59308511/amcharts4-exporting-menu-doesnt-provide-options-for-csv-xlsx-and-json