<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style_box_demo.css">
<script type="text/javascript" src="merge.js"></script>
<script type="text/javascript" charset="utf-8">
<!--frame 位置-->
<!--type:1 折线图 2 柱状图 3 饼状图-->
<!--ymax y轴最大值-->
<!--xtitles x轴下面的标题-->
<!--dataSource 数据源组-->
<!--{-->
<!-- piePercentValue 数值-->
<!-- color 颜色-->
<!-- text 关联名-->
<!-- project 关联项目名-->
<!-- plots 点集合-->
<!-- isShowPoint 显示点-->
<!--}-->
function createchart() {
var options = {
"frame" : [0,104,375,200],
"type":1,
"ymax":1000,
"isShowPoint":1,
"xtitles" :["1", "2", "3", "4", "5", "6", "7", "8" , "9", "10", "11", "12"],
"dataSource" :[
{
"piePercentValue": "10",
"color": [200, 0, 135],
"text":"1组",
"project":"1组",
"plots":["200", "800", "500", "300", "1000", "600", "100", "300" , "500", "600", "700", "800"]
},
{
"piePercentValue": "20",
"color": [10, 50, 205],
"text":"2组",
"project":"2组",
"plots":["700", "300", "400", "500", "300", "500", "700", "800" , "900", "800", "400", "600"]
},
{
"piePercentValue": "20",
"color": [0, 40, 135],
"text":"3组",
"project":"3组",
"plots":["800", "300", "600", "900", "600", "700", "600", "500" , "400", "300", "900", "600"]
}
]
};
showChartView.chartutility(testSuccess,testFailed,[options]);
}
function testSuccess(msg) {
alert(msg);
}
function testFailed(msg) {
alert('failed: ' + msg);
}
function goHome()
{
cordova.exec(testSuccess,testFailed,"ChartUtilityPlugin","remove");
window.location.href = "index.html";
}
</script>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<div class="btn bg_5" onclick="createchart();">生成图表</div><br/>
<div class="btn bg_1" onclick="goHome();">返回</div><br/>
</body>
</html>
出现这种报错的原因是
showChartView.chartutility(testSuccess,testFailed,[options]);
数据类型错误,这里去掉括号即可,已经声明的参数等同于["xxxx"]
showChartView.chartutility(testSuccess,testFailed,options);