Bar chart key position and colors

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 Antonio Vianello on 22nd March 2014
Hi there!

I have a stacked bar chart with many elements for each bar.
How can I avoid the keys box above the chart span horizontally and exceed the canvas area? Can I put the box on the right of the graph?
Another question.
The bars and the keys show a distinct color (i.e. blue, green, yellow, dark blue, light blue) for the first 5 elements only; from the sixth onwards the keys color is black and the corresponding bar elements is shown in green.
How can I dinamically assign colors to the bars and keys based on the number of elements in the stacked bar?

Thanks in advance
Posted by Richard on 24th March 2014
Hi there,

You can put the key on the right of the chart in the gutter - though it may still extend off-canvas if the entries are long. You could use the HTML key to have your key as part of the page instead of as a canvas element.

For the colours you can just have a "master" array containing lots of colours and then pick as many colours as you need from that array.

Or simply assign all of those colours to the bar chart and the unneeded ones won't get used.


Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

Add a reply




« Back to message list