从highcharts导出csv [英] export csv from highcharts

查看:235
本文介绍了从highcharts导出csv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是angular-5,angular2-highcharts版本0.5.5和highcharts版本6.0.7。

I'm using angular-5,angular2-highcharts version 0.5.5 and highcharts version 6.0.7.

我要在html中添加

Png可以正常工作,但是我不能用csv来获取它:

Png one works fine, but I can't got it with 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导出做其他事情。有人可以帮我吗?

I think I need to do something else for csv export. Can anybody help me?

推荐答案

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

You need the export-data module. It extends a chart with downloadCSV method.

function downlaodCsv() {
  chart.downloadCSV()
}

实时示例: http://jsfiddle.net/z1j4enox/

这篇关于从highcharts导出csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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