我想用Chart.js绘制折线图,我遵循Chart.js的“入门”部分,但我仍然无法绘制示例图表。我的代码有什么问题?据NetBeans的这一切都确定..使用Charts.js在HTML5中创建图表
下面的代码:
<!doctype html>
<html lang="nl">
<head>
<meta charset="utf-8">
<title>Become a member</title>
<script type="text/javascript" src="Chart.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.onLoad = function() {
init();
};
function init() {
var ctx = $("#myChart").get(0).getContext("2d");
var myNewChart = new Chart(ctx).Line(data, options);
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
fillColor: "rgba(220,220,220,0.5)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
data: [65, 59, 90, 81, 56, 55, 40]
},
{
fillColor: "rgba(151,187,205,0.5)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
data: [28, 48, 40, 19, 96, 27, 100]
}
]
}
}
</script>
<div>
<section>
<article>
<canvas id="myChart" width="400" height="400">
</canvas>
</article>
</section>
</div>
</body>
</html>
任何帮助都更受欢迎!
链接到插件 - >http://www.chartjs.org/docs/
亲切的问候
格伦
你似乎不具有任何jQuery的参考,虽然你的页面内使用: –
菲利波斯兹,谢谢你的评论,它似乎我错过了它,当我复制我的代码。我的jQuery链接是: – Glenn