Transparent color problem

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Othmar Gattringer on 13th January 2014
Hello I have a simple color problem.

I have a chart with 6 line graphs. I want to make a button to switch a line on or off. So i give a hidden line 'transparent' color. This works well. If i click on the button the line was hidden.
If i get the line the original color back, the line will be not displayed (is still transparent) if i query the line color (Get('chart.colors')) the color is set but not line was displayed.

This is my code:
        
function onoff(){
           var line = RGraph.ObjectRegistry.getObjectsByType('line');

           var col = line[2].Get('chart.colors');
            alert(col);
           
           if (col != "transparent"){
              line[2].Set('chart.colors', 'transparent');
           }else{
              line[2].Set('chart.colors', 'rgba(255,0,0,1)');
           }
           RGraph.Redraw();
}

Is this a bug or do i something wrong?

Best Regards
Othmar
Posted by Richard on 13th January 2014
Hi there,


The colors option is an array. So try this:

line[2].Set('colors', ['transparent']);

(You also don't need to give the "chart." in the setting name.)




Richard, RGraph Support
www.rgraph.net
Please link to the RGraph website
Posted by Othmar Gattringer on 13th January 2014
Thank you very much! It works. Great work.

Add a reply




« Back to message list