我安装了带有2.1.1版本的PhantomJS。它适用于控制台日志记录示例。我的问题是如何从命令行或作为Weberver使它在Windows环境中工作。我正在尝试将其用作每个Improved image export with PhantomJS
的HighCharts呈现WebServer。我正在使用Fiddler将发帖请求发送到说明中定义的主机,但是该请求返回500响应。
当我将示例作为命令行方法分解时,执行将给出响应:
{}
Highcharts.options.parsed
Highcharts.customCode.parsed
ReferenceError:找不到变量:Highcharts
TRACE: ->未定义:63(在函数“ createChart”中) ->:149
phantomjs://code/highcharts-convert.js:719 in onError退出时 消息“错误:ReferenceError:找不到变量:Highcharts”
phantomjs highcharts-convert.js -infile infile.js -outfile chart.png -scale 2.5 -width 300 -constr Chart -callback callback.js
infile.js:
{
"xAxis":{
"categories":[
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
]
},
"series":[
{
"data":[
29.9,
71.5,
106.4,
129.2,
144.0,
176.0,
135.6,
148.5,
216.4,
194.1,
95.6,
54.4
]
}
]
}
callback.js
function(chart) {chart.renderer.arc(200, 150, 100, 50, -Math.PI, 0).attr({fill : '#FCFFC5',stroke : 'black','stroke-width' : 1}).add();}