使用Highcharts export module生成图表图片

首先搭建本身的export server (nodejs版)

highcharts官方提供的export server https://export.highcharts.com...node

nodejs的版本尽可能选择最新的稳定版本git

git clone https://github.com/highcharts/node-export-server
npm install
npm linkgithub

启动服务

highcharts-export-server --enableServer 1 --port 8881 --logLevel 4npm

建议采用forever的方式启动
forever start -w ./bin/cli.js --enableServer 1 --port 8881 --logLevel 4 --killSignal SIGINTsegmentfault

注意事项

  • 启动的过程当中若是报错 /lib64/libz.so.1: no version information available,则须要更新libz的版本
    ,更新过程参考(http://blog.csdn.net/xanxng/a...字体

  • 安装系统上若是没有合适的字体库,导出的图片将没法显示标题、x轴、y轴以及图例,安装字体能够参考(https://segmentfault.com/a/11....net

使用接口导出图片

以官方提供的服务为例code

Request URL:https://export.highcharts.com...
Request Method:POST
Content-Type: multipart/form-data
Request Payload: 参考(https://www.highcharts.com/do...orm

官方文档

https://www.highcharts.com/do...
https://github.com/highcharts...server

相关文章
相关标签/搜索