js 报错:参数无效 的问题
最近想用highcharts做个饼图,遇到个小问题。
页面 aa.jsp 代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<script type="text/javascript" src="../scripts/jquery.min.js" ></script>
<script type="text/javascript" src="../scripts/highcharts.js" ></script>
<script type="text/javascript" src="../scripts/excanvas.compiled.js"></script>
<script type="text/javascript" src="../scripts/main.js"></script>
<body>
<script type="text/javascript">
function show ()
{
alert("cc");
var result = [('zsl',14),
('lln',15),
('aa',18),
('bb',19)];
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
title: {
text: 'Combination chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
},
tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = '<b>Total fruit consumption</b><br/>'+
this.point.name +': '+ this.y +' fruits';
} else {
s = '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y;
}
return s;
}
},
labels: {
items: [{
html: 'Total fruit consumption',
style: {
left: '40px',
top: '8px',
color: 'black'
}
}]
},
series: [{
type: 'pie',
name: 'Total consumption',
data: result,
center: [300, 100],
size: 200,
showInLegend: false
}]
});
}
</script>
<div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div>
</body>
顺序: bb.js 调用aa.jsp中show() 然后 aa.jsp显示饼图
js报错 :行 8 错误:参数无效