Y-axis scale problem with a Bar chart

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 Susan on 2nd February 2017
I am using RGraph 4.58 stable and your Bar chart Grow effects demo, which works. But when I change the data to [1,1,1,1,1,1,1], the y-axis has multiple values of 1 instead of just one at the top. Also, if I change the data to [1,2,1,1,1,1,1], the max y-axis value is 5, even though the largest data value is 2. I was going to use your library for a project, but not with these issues. Can these be addressed soon?
Posted by Richard on 2nd February 2017
Hi there,

It probably can be addressed yes - but you'll need to configure it correctly first. Adding:

...
scaleDecimals: 1
...

To your configuration will let you see decimals instead of the values being rounded. And with regards to the top value being 5 when the maximum value is 2 - the scale is geared towards generating nicer scale values which in this case is:

5
4
3
2
1
0

If you want the max value you could specify this:

...
ymax: RGraph.arrayMax([1,2,1,1,1,1,1])
...






Richard
Posted by Richard on 2nd February 2017
Hi there,

This applies to the canvas charts BTW - the property names are slightly different for the SVG charts.


Richard
Posted by Enter your name... on 2nd February 2017
Thanks for the quick reply. However this does not give me the accuracy I need. When I added to my configuration ymax: 1.2, and scaleDecimals: 1, the y-axis appears evenly divided, but the values alternated between .2 and .3 increments. Also the bar graph heights for 1 show above the y-axis value of 1.
Is there anyway to control the number of divisions on the y-axis?
Posted by Richard on 2nd February 2017
Hi there,

Sounds like you need more decimal places:

...
scaleDecimals: 2
...


Richard
Posted by Richard on 2nd February 2017
Hi there,

Oh and to get more decimals you culd do this:

...
ylabelsCount: 10
...






Richard
Posted by Susan on 2nd February 2017
That's getting closer to what I need. Since my data is coming from an interactive database on a server, I need to be able to have the y-axis show clean values that are easily read without having to be interpreted. I was really liking this product until this came up. I would love it if I didn't have to go the decimal route especially when the data represents integer values.
Posted by Richard on 3rd February 2017
Hi there,

Using the ylabelsSpecific option you can have them say whatever you want.

www.rgraph.net/canvas/docs/bar.html#ylabelsSpecific




Richard

Add a reply




« Back to message list