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

More »

 

Download
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 cdnjs.com hosted libraries.

More »

 

License
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 »

Addition to the Bipolar library


Posted by Olivier at 11:22 on Sunday 23rd January 2022 [link]
Hi team,

I just improved bipolar graph to enable different colors left vs. right.
I would like to contribute to RGraph improvement but I don't know if that is possible and how to proceed.

Good day,
Olivier

Posted by Richard at 19:28 on Sunday 23rd January 2022 [link]
Feel free to post it in a reply to this message and I'll take a look at it.

Posted by Olivier at 10:07 on Sunday 6th February 2022 [link]
Here it is. In the bipolar.js

First proposal : be able to set a background color for text area
I declared a new property
     textBackground: null,

In drawLabels function
     if (properties.textBackground != null) {
this.context.fillStyle = properties.textBackground;
this.context.fillRect(this.marginLeft + this.axisWidth, this.marginTop, barAreaWidth, barAreaHeight);
     }

Second proposal : be able 2 differents set of colors Left and Right
I declared 2 new properties
    leftColors: null,
    rightColors: null,

In draw function, I added
    if (properties.leftColors === null)
properties.leftColors = properties.colors;
    if (properties.rightColors === null)
properties.rightColors = properties.colors;

And in drawLeftBars and drawRigthBars, I replace respectively colors by leftColors and rightColors.

Hope it is clear, Let me know if you need further information.
Have a good day

Posted by Richard at 15:01 on Sunday 6th February 2022 [link]
Thanks for that. I've implemented the left/right colors for the canvas Bipolar chart - the SVG Bipolar will be done soon.

Regarding the other change - is it supposed to set a background color for the labels in the center of the chart? A background color for the whole of the marginCenter area or just the text?

[Replies are closed]