安裝
安裝phantomjs執行引擎
- 下載地址
https://phantomjs.org/download.html
- Mac下安裝,下載安裝包後解壓到目錄
- 執行以下命令
vim ~/.bash_profile
export PATH=/Users/your_name/phantomjs-2.1.1-macosx/bin:$PATH
# terminal執行
MacBook:~ phantomjs
安裝Highcharts圖表庫
- 下載地址
https://github.com/pesla/highcharts-phantomjs
執行
phantomjs --debug=true /Users/your_name/Highcharts-8.0.0/code/highcharts-convert.js -infile demo.json -outfile chart.png -scale 2.5 -width 300 -constr Chart
執行過程
phantomjs是js的一個執行引擎,可以理解爲js瀏覽器內核
Highcharts是一個js第三方圖表庫