Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript RGraph没有显示任何内容?_Javascript_Html_Graph - Fatal编程技术网

Javascript RGraph没有显示任何内容?

Javascript RGraph没有显示任何内容?,javascript,html,graph,Javascript,Html,Graph,我只是尝试使用RGraph生成一个图表,这样我就可以开始使用SQL来操作这个图表了。然而,我遇到的问题是,它根本没有显示基本图形。有人知道我哪里出了问题吗 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="htt

我只是尝试使用RGraph生成一个图表,这样我就可以开始使用SQL来操作这个图表了。然而,我遇到的问题是,它根本没有显示基本图形。有人知道我哪里出了问题吗

<!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>

图表
[无画布支持]
window.onload=函数()
{
var bar=新的RGraph.bar({
id:'cvs1',
数据:[4,5,3,8,4,9,6,5,3],
选项:{
背景:对,,
标签:[Mal'、'Barry'、'Gary'、'Neil'、'Kim'、'Pete'、'Lou'、'Fred'、'Jobe'],
标题:“虚线背景网格”,
strokestyle:'rgba(0,0,0,0)',
textaccessable:真
}
}).draw();
};
浏览器错误

未捕获的TypeError:无法读取null的属性“getContext”

RGraph.Bar@RGraph.Bar.js:28

window.onload@Charts.php:17


我测试了你的代码。它没有问题,但它似乎非常依赖于您使用的RGraph版本。尝试下载并将“库”下的内容(或仅两个文件)解压缩到“JAVASCRIPT”文件夹中

我测试了你的代码。它没有问题,但它似乎非常依赖于您使用的RGraph版本。尝试下载并将“库”下的内容(或仅两个文件)解压缩到“JAVASCRIPT”文件夹中

以下是一些更新的代码(自询问后,一些属性名称已更改)

下面是一些更新的代码(自提出此问题以来,一些属性名称已更改)


你有没有检查你的浏览器控制台有没有js错误?我刚刚在我的帖子中添加了我收到的错误。你有没有检查你的浏览器控制台有没有js错误?我刚刚添加了我收到的帖子中的错误。这已经起作用了。我只是更新了文件。谢谢你的帮助,没问题!享受SQL的乐趣。这很有效,我只是更新了文件。谢谢你的帮助,没问题!享受SQL带来的乐趣。
bar = new RGraph.Bar({
     id:'cvs1',
     data: [4,5,3,8,4,9,6,5,3],
     options: {
         backgroundGridDashed: true,
         xaxisLabels: ['Mal', 'Barry', 'Gary', 'Neil', 'Kim', 'Pete', 'Lou', 'Fred', 'Jobe'],
         title: 'A dashed background grid',
         colorsStroke: 'transparent'
         // textAccessible: true // Defaults to true anyway
     }
 }).draw();