2

我正在使用 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 导出做其他事情。有谁能够帮助我?

4

1 回答 1

4

您需要导出数据模块。它用方法扩展了一个图表downloadCSV

function downlaodCsv() {
  chart.downloadCSV()
}

现场示例:http: //jsfiddle.net/z1j4enox/

于 2018-04-22T17:00:15.333 回答