X axis center on 0 - how?

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 Lee on 2nd June 2014
I have Y-axis with max = 1.00 and min= -20000.00. Both are set as in ymin and ymax.

First, the labels are weird: with top 1.00 and bottom -1.00, and center -20000.00. Below the center are numbers with double negative, such as --1999.0.

I have to set ymin and ymax so that other cases work. In my cases, all numbers are possible.

I would like to always center the chart at 0 (instead of -20000.00). How do I do that?
Posted by Richard on 3rd June 2014
You can use the ymin a ymax to get a quarter axis cxhart like this:

www.rgraph.net/fiddle/view/a-line-chart-with-a-quarter-axis-but-not-using-the-traditional-method

Otherwise the way that I've made quarter axis charts is a little more involved:

www.rgraph.net/demos/line-quarter-axis-dual-color.html
www.rgraph.net/demos/line-quarter-axis-inverted.html
www.rgraph.net/demos/line-quarter-axis.html
www.rgraph.net/demos/line-quarter-axis2.html



Richard
Posted by Lee on 20th June 2014
I followed your sample and it is not working. My chart is a bar chart and I still see double negative in the Y-axis. In addition, the bar is drawn from -20000.00 and below. Could you try with bar chart? Thank you very much.
Posted by Richard on 20th June 2014
Put your chart online so that I can see what you're doing.





Richard
Posted by Lee on 20th June 2014
Thsnks for quick response. Here is an example without re-drawing x-axis.

primeaim.com/public/charts.php?company=ALPC+-+0001565220+-+ALPHALA+CORP.&;concept=NetIncomeLoss&months=3&report_fiscal_year=&report_fiscal_period=&act=1011

In addition to issues mentioned above with redrawing x-axis, the "text-angle" (45 degree) can't work any more.

Any suggestions will be greatly appreciated.
Posted by Richard on 23rd June 2014
Scales are mirrored when the X axis is in the center - so you only need to set the ymax to 20000 (or whatever). In addition the text angle should be a number - not a string - so no quotes:

obj.set('text.angle', 45);




Richard
Posted by Lee on 23rd June 2014
Removing y-min seems to work. Thank you!

Add a reply




« Back to message list