我想用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