我只是試圖使用RGraph生成圖表,以便我可以開始使用SQL來操縱圖形。但是,我遇到的問題是它根本沒有顯示基本圖形。任何人都知道我在哪裏錯了嗎?RGraph不顯示任何東西?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Charts</title>
<script src="JAVASCRIPT/RGraph.common.core.js"></script>
<script src="JAVASCRIPT/RGraph.bar.js"></script>
</head>
<body>
<canvas id="cvs1" width="600" height="250">[No canvas support]</canvas>
<script>
window.onload = function()
{
var bar = new RGraph.Bar({
id:'cvs1',
data: [4,5,3,8,4,9,6,5,3],
options: {
backgroundGridDashed: true,
labels: ['Mal', 'Barry', 'Gary', 'Neil', 'Kim', 'Pete', 'Lou', 'Fred', 'Jobe'],
title: 'A dashed background grid',
strokestyle: 'rgba(0,0,0,0)',
textAccessible: true
}
}).draw();
};
</script>
</body>
</html>
瀏覽器錯誤
Uncaught TypeError: Cannot read property 'getContext' of null
RGraph.Bar @ RGraph.bar.js:28
window.onload @ Charts.php:17
你檢查了瀏覽器控制檯是否有任何js錯誤? –
我剛剛添加了錯誤,我得到我的帖子 –