Negative ymin on Bar charts


« 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):

www.rgraph.net/demos/line-offset-x-axis.html

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] ...like this:

www.rgraph.net/fiddle/view.html/bar-chart-with-offset-x-axis

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.


Richard
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
Hi,

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






Richard

Add a reply

 




« Back to message list
RGraph on social media