I have a transparent color problem on a Line chart

« 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');
           if (col != "transparent"){
              line[2].Set('chart.colors', 'transparent');
              line[2].Set('chart.colors', 'rgba(255,0,0,1)');

Is this a bug or do i something wrong?

Best Regards
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.)

Posted by Othmar Gattringer on 13th January 2014
Thank you very much! It works. Great work.

Add a reply

« Back to message list