AmCharts4:“导出"菜单不提供CSV,XLSX和JSON的选项 [英] AmCharts4: Exporting menu doesn't provide options for CSV, XLSX and JSON

查看:88
本文介绍了AmCharts4:“导出"菜单不提供CSV,XLSX和JSON的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AmCharts4,并且希望以CSV,XLSX和JSON格式导出图表数据.

I'm using AmCharts4 and I want to export chart data in CSV, XLSX and JSON format.

我在index.html中包含以下脚本: <script src="https://www.amcharts.com/lib/4/core.js"></script> <script src="https://www.amcharts.com/lib/4/charts.js"></script>

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>

: ... import * as am4core from "@amcharts/amcharts4/core"; ... let chart4 = am4core.create("chartdiv4", am4charts.XYChart); chart4.exporting.menu = new am4core.ExportMenu();

in .ts file: ... import * as am4core from "@amcharts/amcharts4/core"; ... let chart4 = am4core.create("chartdiv4", am4charts.XYChart); chart4.exporting.menu = new am4core.ExportMenu();

,我没有获得所有用于数据导出的选项: 提供的选项是HTML和PDF

and I'm not getting all the options for data export: options that are provided are HTML and PDF

是什么原因造成的?

谢谢, 比尔贾纳(Biljana)

Thanks, Biljana

推荐答案

我已经设法解决了这个问题.

I've managed to solve this.

需要填充图表的data属性,然后 ,您需要将ExportMenu的实例分配给图表的exporting.menu属性.

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.

这篇关于AmCharts4:“导出"菜单不提供CSV,XLSX和JSON的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆