About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 15 years old) and has a wealth of features making it an ideal choice to show charts on your website.

More »

 

License
RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£99) commercial license available.

More »

 

Download
Get the latest version of RGraph (version 6.17) from the download page. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

More »

The scale on my Bar chart is showing incorrectly


Posted by Jerry at 17:22 on Friday 19th May 2023 [link]
Hello,

My Bar chart is showing the scale as 0,0,0,1,1,1 instead of 0,0.2,0.4,0.6,0.8,1.0 - how can I fix this?

Posted by Richard at 17:39 on Friday 19th May 2023 [link]
The scale is showing like that because of rounding. The maximum value on the scale is being set to 1 - and then divided by five to come up with a scale like this: [0,0.2,0.4,0.6,0.8,1.0]. However, the numbers are rounded in order to fit in with the number of decimals - which by default is zero. So the numbers are being rounded to what you're seeing.

The solution here is to set the yaxisScaleDecimals propety to 1 - that way you'll see your Y axis labels as expected: [0,0.2,0.4,0.6,0.8,1.0].

[Replies are now closed]