Bipolar - different colors for each side

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Harold on 16th January 2016
Is it possible to have each side of a Bipolar a different color? One side is positive and the other is negative, so I'm thinking Red and Green.
Thanks....
Posted by Richard on 16th January 2016
Hi,

Yes - you can use the colorsSequential option. IIRC they're used from top to bottom, left side first.

Richard
Posted by Juan on 24th May 2016
Not working for me, thats my code:

new RGraph.Bipolar({
             id: 'id',
             left: datosHombres,
             right: datosMujeres,
             options: {
                 colors: ['red','red','red','red','red','red','red','red','red','red',
                          'blue','blue','blue','blue','blue','blue','blue','blue','blue','blue'],
                 textAccessible: true,
                 textSize: 14,
                 gutterCenter: 90,
                 axisColor: 'rgba(0,0,0,0)',
                 labels: etiquetas,
                 colorsSequential:true
             }
         }).wave();
Posted by Juan on 24th May 2016
Solved the issue by changing some library code(RGraph.Bipolar.js):

968 // If chart.colors.sequential is specified - handle that
                 if (prop['chart.colors.sequential']) {
                  var offsetColors = 0;
                  if (prop['chart.colors'].length == this.right.length * 2) {
                   offsetColors = this.right.length;
                  }
                     co.fillStyle = prop['chart.colors'][offsetColors + i];
                 } else {
                     co.fillStyle = prop['chart.colors'][0];
                 }

Add a reply




« Back to message list