如何将JavaScript图表导出到Excel文件(HighCharts) [英] How to Export JavaScript Chart to Excel file (HighCharts)

查看:998
本文介绍了如何将JavaScript图表导出到Excel文件(HighCharts)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须导出Javascript图表(HighCharts)到excel文件;该图表在一个div中呈现,但是excel不会呈现javascript生成的html + css内容,只呈现没有样式的文本。

I have to Export a Javascript chart (HighCharts) into an excel file; the chart was rendered in a div, but the excel doesn't render the html+css content the javascript generates, render only the text without style.

转换这里图表被渲染成一个图像(jpeg),但我没有成功...

A solution would be convert this where the chart was rendered into an image(jpeg) but I have no success...

谢谢!

推荐答案

HighCharts已经通过与其一起打包的导出模块支持图像导出功能。 导出获取后,您应该能够修改脚本以保存图像以任何你需要的方式。这当然不是一个初学者的任务,需要大量的修改。

HighCharts already supports the image exporting functionality via the Exporting Module which is packaged with it. Exporting After getting it you should be able to modify the script to save the image in any way you need. It's certainly not a beginners task and will require lots of tinkering.

如果是我,我将修改响应导出按钮的代码,以便我可以激活它JavaScript并传递信息,以便后端的PHP文件可以以您想要的方式保存图片,而不是将其返回给客户端。

If it were me I would modify the code that responds to the export button so that I can activate it with JavaScript and also pass in information so that the PHP file on the back-end could save the picture in the manner you want rather than returning it to the client.

这篇关于如何将JavaScript图表导出到Excel文件(HighCharts)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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