How do I set the maximum size of a Bar chart node?

« 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 varghese on 24th April 2013
       In my application the number of nodes in bar chart will change dynamically,
When the number of nodes decreases the node width is so high and this affects the look and feel.Is there any property to make maximum size for the width of a node.The following is a sample images URL of Rgraph.In second one i want to set the max size of the node.I have already used bar3.Set('chart.hmargin',20);to adjust the gap between each node.

Thanks & regards
Posted by RGraph support on 24th April 2013
Hi there,

To keep the bars the same size you will need to increase the hmargin accordingly. There's no option to do this for you so some maths will be involved. Eg in a canvas thats 600px wide, the gutters default to 25px so that leaves you 550px. If you set the chart.hmargin to 250 then that will leave 50 pixels for the bar. A simple calculation gives you this:

hmargin = (((canvas.width - gutterLeft - gutterRight) / numbars) - desiredWidth) / 2

PS - cheers!

Richard, RGraph Support

Add a reply

« Back to message list