.net Powerful JavaScript charts
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 use for showing charts on your website.

More »


Get the latest version of RGraph (version 6.18, 1st June 2024) from the download page. You can read the changelog here. There's also older versions available, minified files and links to hosted libraries.

More »


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

More »

I have a problem scaling the Horizontal Bar X-axis

Posted by reini at 20:33 on Friday 1st April 2022 [link]
Is it possible to scale the x-axis in a horizontal bar chart.
I tried to use the option xaxisScaleMax:2.5 which works fine.But when i use xaxisScaleMin:1.0 too, the chart doesen't work.
Both options are not documented.
Any idea?
Thank you

Posted by Richard at 21:08 on Friday 1st April 2022 [link]
The HBar X-axis seems not to be scaling correctly automatically, but you can do this. If your data is very dynamic then this might need a bit more work - here's the CodePen:

Posted by reini at 11:48 on Saturday 2nd April 2022 [link]
Thank you for fast answer.
Since i'm using php to import the data from mysql i'm could scaling the data there. I need this adaption to "zoom" my datas. Datas with small differences should be shown in the bar diagramm with clear distances.
Many greetings from germany

Posted by Richard at 12:31 on Saturday 2nd April 2022 [link]
Was that OK for you then? FYI I'm working on fixing the HBar at the moment. I'll let you know when I've done it.

Posted by Richard at 18:47 on Sunday 3rd April 2022 [link]
Ok I believe that I've now fixed the HBar chart so give the attached files a try and see how it works for you. The code that I've used to create the chart is as follows:

    new RGraph.HBar({
        id: 'cvs',
        data: [1.6,1.9,1.6,2.2,2.5,2.1,1.6],
        options: {
            xaxisScaleMin: 1,
            xaxisScaleMax: 2.5,
            xaxisScaleDecimals: 1,
            marginInner: 10

Also, the file attachment functionality is new - so be aware that it may have a bug or two!
Attached files:
Attachment - RGraph.common.core.js

Posted by Galanopd at 19:22 on Tuesday 5th April 2022 [link]
I am facing a similar issue with Joomla plugin.
Although I have added xaxisScalexMax="2.016" in an HBar, since my table has 2.016 rows the graph shows 2.500 as the last number on x.

Is there a way to limit this?

Posted by Richard at 20:10 on Tuesday 5th April 2022 [link]
That's due to RGraph generating a nicer scale for you. Something that goes from 0 up to 2016 would generate some odd numbers in between.

But if you really want this then you can set the xaxisScaleMax property to 2016. Like this:

xaxisScaleMax: 2016,

Posted by Galanopd at 10:47 on Wednesday 6th April 2022 [link]
That worked, thank you

[Replies are closed]