How do I create Bar charts which have negative values shown on top of the X axis?

« 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 BT on 20th April 2016
I have data with both positive and negative values (lets say range -5 to +25) I want all the bars to be above the xaxis so I set
xaxispos: bottom,
ymin: -5

The result is my positive values look bigger (expected) but my negatives are still below the xaxis. How do I get the negative bars to be on top of the xaxis?
Posted by Richard on 20th April 2016
Hi there,

The Bar chart doesn't yet support offset X axes like the Line chart does (recently added):

But when I do add it, the X axis will be at zero (like this chart) and not at the bottom.

I suppose you could make it currently by using the drawing API... [15 minutes pass] this:

Is that the sort of thing you want? The 'real' scale of the Bar chart goes from 0 to 30 but its axes are turned off and custom ones are added using the drawing API so that the yaxis thats displayed has the desired scale.

NB: It uses the latest libraries that I released yesterday (4.54) so it might be worth updating. Certainly if you want the textAccessible option to work.

Posted by BT on 21st April 2016
Thanks for your reply. I took what you did but instead of removing/drawing new axis, I set ylabels.specific and that seemed to give me what I needed.
Posted by Richard on 21st April 2016

That's certainly an less convoluted way to do it!


Add a reply

« Back to message list