Addition to the Bipolar library - Official support forum |

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,

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 now closed]