AmCharts4: Exporting menu doesn't provide options for CSV, XLSX and JSON

£可爱£侵袭症+ 提交于 2020-08-10 20:16:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!