I have an alert being displayed in my browser with my chart

« 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 Aram on 12th December 2012

Can you help me? What is wrong in my code?

  <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
$sql = "SELECT id FROM pos_sale ";
$result = mysql_query($sql) or die ('Query Error: ' . mysql_error());
echo "rd=[";
while ($results = mysql_fetch_assoc($result))
     echo (($n==0) ? '' : ', ').$results['id'];
echo "];";
       window.onload = function ()
             var bar = new RGraph.Bar('cvs', [1,rd]);
             bar.Set('background.image', '../images/bg.png');
             bar.Set('background.grid', false);
             bar.Set('labels', ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']);
             bar.Set('key', ['Sunshine in 2000', 'Sunshine in 2005']);
             bar.Set('key.position.gutter.boxed', false);
             bar.Set('key.position', 'gutter');
             bar.Set('key.background', 'rgb(255,255,255)');
             bar.Set('colors', ['yellow', 'red']);
             bar.Set('shadow', true);
             bar.Set('shadow.blur', 15);
             bar.Set('shadow.offsetx', 0);
             bar.Set('shadow.offsety', 0);
             bar.Set('shadow.color', '#aaa');
             bar.Set('strokestyle', 'rgba(0,0,0,0)');
             bar.Set('gutter.left', 55);
             bar.Set('gutter.right', 5);
             bar.Set('hmargin.grouped', 1);
             RGraph.Effects.Fade.In(bar, {'duration': 500, 'frames': 10});
Posted by RGraph support on 12th December 2012

Any error message will be in your Javascript console - what does it say in there?
Posted by Aram on 12th December 2012
[RGRAPH]: Warning: You have a negative bar width. This may be cost by the graph hmargin.....I see this alert (Google Chrome)
After pressing ok I can see the graph.
In console log there are no errors.

Also it does not work in Explorer and Mozilla.
What can I do?
Thank you for your response!
Posted by RGraph support on 12th December 2012

Set chart.hmargin to 0 and/or widen your canvas.

Add a reply

« Back to message list