我正在使用 Angular-5、Angular2-highcharts 版本 0.5.5 和 highcharts 版本 6.0.7。
我想在我的 html 中而不是在图表中添加一个按钮,用于下载 png 或 csv 格式的图表。
PNG 一个工作正常,但我无法使用 csv 获取它:
这是我的代码:
downloadPng(): void { //this one works
this.chart.exportChart({
type: 'image/png',
filename: this.title
});
}
downloadCsv(): void { //this one crashes
this.chart.exportChart({
type: 'text/csv',
filename: this.title
},{
itemDelimiter: ';',
csv: this.chart.getCSV()
});
}
当崩溃时,它会重定向到
https://export.highcharts.com/
使用此文本
unexpected return from chart generation - please check your input data
我想我需要做一些其他的事情来导出 csv。有人可以帮助我吗?
最佳答案
您需要export-data模块。它使用 downloadCSV
方法扩展图表。
function downlaodCsv() {
chart.downloadCSV()
}
关于highcharts - 从 highcharts 导出 csv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49919506/