I have a problem scaling the Horizontal Bar X-axis - Official support forum | RGraph.net

I have a problem scaling the Horizontal Bar X-axis

Post a reply

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
greetings
reini

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:

https://codepen.io/rgraph/pen/vYpWYJz

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
Reini

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
        }
    }).draw();

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
RGraph.common.core.j...
Attachment - RGraph.hbar.js
RGraph.hbar.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

Post a reply

What's your name?
What do you want to say?