当我尝试根据本教程在服务器端渲染图表时出现以下错误。
phantomjs highcharts-convert.js -infile options1.json -outfile chart1.png -scale 2.5 -width 300 -constr Chart -callback callback.js
SyntaxError: Parse error
SyntaxError: Parse error
Highcharts.options.parsed
Highcharts.callback.parsed
ReferenceError: Can't find variable: Highcharts
phantomjs://webpage.evaluate():58
phantomjs://webpage.evaluate():103
phantomjs://webpage.evaluate():103
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
loading images...
以下是与 hightcharts-convert.js 文件在同一目录下的文件。
ls
callback.js highcharts-more.js highstock.js options1.json
highcharts-convert.js highcharts.js jquery-1.8.2.min.js readme.md
options1.json 的内容
{
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();
}