RGraph Bar chart with a drawing API Y axis object

« 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 michel K on 11th March 2014
I'm trying to add an Y axis to my bar but I'm not able to get it to work...

When I change the line var bar = new RGraph.Bar into var line = new RGraph.Line it displays the y axis


window.onload = function ()
     var bar = new RGraph.Bar('cvs', [4,8,6,5,3,2,2,5])
     .Set('hmargin', 5)
     .Set('noaxes', true)
     .Set('ylabels', false)
     .Set('gutter.left', 150)
     .Set('colors', ['black'])
     .Set('tooltips', ['James','Jenna','Karl','Olga','Mark','Pete','Louise','Jack'])
     .Set('linewidth', 3)
     .Set('spline', true)

     var yaxis = new RGraph.Drawing.YAxis('cvs',line.gutterLeft)
     .Set('max', line.max)
     .Set('title', 'Widgets sold')
     .Set('colors', ['black'])
Posted by Richard on 12th March 2014
Hi there,

You're still referencing the line object when you create the yaxis object. So change this:

var yaxis = new RGraph.Drawing.YAxis('cvs',line.gutterLeft)

To this:

var yaxis = new RGraph.Drawing.YAxis('cvs',bar.gutterLeft)


Add a reply

« Back to message list