Is there an example of a Bar chart that shows a total?


« 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 Mar on 23rd November 2017
Hi Richard,

I can't find sample for bar charts showing totals.
Can you point me to where it is.


Regards,
Mar
Posted by Richard on 23rd November 2017
Hi there,

Do you mean something like this example which has the totals above each bar? The labelsAbove option will do that for you.

www.rgraph.net/fiddle/view.html/a-stacked-svg-bar-chart

Richard
Posted by Mar on 24th November 2017
Hi Richard,

Unfortunately not like that.

What I would like to have is the sum of all bars,
so for example from the link you've shared the total would 782kg.

Best Regards,
Mar
Posted by Richard on 24th November 2017
Hi there,

OK I've updated the example for you and it's now showing two methods that you could use. You could set a title and just create one that has the total append to it. Or you can use the RGraph.SVG.text() function to add your own text to the chart.

As its SVG you don't need to use an ondraw event if you subsequently add tooltips.

I've update the example for you:

www.rgraph.net/fiddle/view.html/a-stacked-svg-bar-chart

Richard
Posted by Mar on 27th November 2017
Thanks Richard, that works!

Best Regards,
Mar

Add a reply




« Back to message list