我正在使用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做点别的事情 . 有谁能够帮我?
1 回答
你需要export-data模块 . 它使用
downloadCSV
方法扩展了图表 .实例:http://jsfiddle.net/z1j4enox/