Unable to use RGraph in conjunction with PHP

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by durai gowthaman on 26th October 2016
Hi, I am new to PHP. I need to present the data in the form of charts using PHP. Then I saw RGraph and used cdn for including .js files in PHP. I displays nothing. Help me to fix the problem.

My Coding :
<html>
     <head>
         <script src="cdn.jsdelivr.net/rgraph/20131231/libraries/RGraph.common.core.js\"></script>
<script src="cdn.jsdelivr.net/rgraph/20131231/libraries/RGraph.common.dynamic.js\"></script>
<script src="cdn.jsdelivr.net/rgraph/20131231/libraries/RGraph.common.tooltips.js\"></script>
<script src="cdn.jsdelivr.net/rgraph/20131231/libraries/RGraph.bar.js\"></script>
     </head>
     <body>
        <div id="gauge" class="200x160px"></div>
<script>
     new RGraph.Bar({
         id: 'gauge',
         data: [ [4,8,3],[5,2,1], [8,4,2],[3,6,1],[5,1,0],[2,5,1],[1,2,2] ],
         options: {
             variant: '3d',
             strokestyle: 'rgba(0,0,0,0)',
             colors: ['Gradient(#fbb:red)', 'Gradient(#bfb:green)','Gradient(#bbf:blue)'],
             gutterBottom: 80,
             labels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
             shadowColor:'#ccc',
             shadowOffsetx: 3,
             backgroundGridColor: '#eee',
             variantThreedAngle: 0.1,
             axisColor: '#ccc'
         }
     }).draw();
</script>
     </body>
</html>
Posted by Richard on 26th October 2016
Hi there,

1. You're using an old version of the RGraph libraries which probably don't support the camel-case style property names. So try using the latest download from the website and host them yourself on your website.

2. You have no CANVAS tag - just a DIV tag. You'll need something like this:

<canvas id="gauge" width="200" height="160">[No canvas support]</canvas>




Richard
Posted by durai gowthaman on 27th October 2016
Thanks dude

Add a reply




« Back to message list