I'm using RGraph on a Raspberry Pi and all I get is a blank page
« Back to message list
I am a complete noob on some of this stuff. I probably have something simply wrong. I want to use some guages to show
temperatures from sensors on a raspberry pi. I found this site and I thought Aha! Not so much so far, my own ignorance
for sure. Here is the code I have
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../libraries/RGraph.common.core.js"></script>
<script src="../libraries/RGraph.gauge.js"></script>
<title>Test Guage Page!</title>
</head>
<body>
<canvas id="cvs" width="250" height="250">
[No canvas support]
</canvas>
<script>
window.onload = function ()
{
var gauge = new RGraph.Gauge({
id: 'cvs',
min: 0,
max: 10,
value: 3.2
}).draw();
};
</script>
</body>
</html>
My file is in /var/www/Rgraph directory. All the other Rgraph files and folders are in this directory. What do I have wrong? Can someone tell me?
Thanks
Posted by Richard on 15th January 2016<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../libraries/RGraph.common.core.js"></script>
<script src="../libraries/RGraph.gauge.js"></script>
<title>Test Guage Page!</title>
</head>
<body>
<canvas id="cvs" width="250" height="250">
[No canvas support]
</canvas>
<script>
window.onload = function ()
{
var gauge = new RGraph.Gauge({
id: 'cvs',
min: 0,
max: 10,
value: 3.2
}).draw();
};
</script>
</body>
</html>
My file is in /var/www/Rgraph directory. All the other Rgraph files and folders are in this directory. What do I have wrong? Can someone tell me?
Thanks
Hi,
The code is fine - the only thing that I can see may be wrong is the paths to the libraries.
If your files are in /var/www/Rgraph as you say then create a folder in there called libraries and put the libraries in it, so the paths to them look like this:
/var/www/Rgraph/libraries/RGraph.common.core.js
/var/www/Rgraph/libraries/RGraph.gauge.js
Then in your HTML file you can refer to them like this:
<script src="./libraries/RGraph.common.core.js"></script>
<script src="./libraries/RGraph.gauge.js"></script>
Richard
The code is fine - the only thing that I can see may be wrong is the paths to the libraries.
If your files are in /var/www/Rgraph as you say then create a folder in there called libraries and put the libraries in it, so the paths to them look like this:
/var/www/Rgraph/libraries/RGraph.common.core.js
/var/www/Rgraph/libraries/RGraph.gauge.js
Then in your HTML file you can refer to them like this:
<script src="./libraries/RGraph.common.core.js"></script>
<script src="./libraries/RGraph.gauge.js"></script>
Richard
Add a reply
« Back to message list