javascript - How to distinguish Highcharts background color for if statement -


i want change background color of highcharts highstock chart on pressing button. if bg color white default, wanna change gradient filling. otherwise should white. there should switch between 2 color options basically.

as posted in thread (changing highcharts background color?), know how change bg color. problem distinguish actual color in chart in order use if statement.

my code looks this:

var gradient = {         lineargradient: [0, 0, 0, 400],                  stops: [ [0, 'rgb(96, 96, 96)'],                            [1, 'rgb(16, 16, 16)'] ]         };  if( chart.backgroundcolor == 'ffffff' )     {         console.log('if white');         chart.chartbackground.attr({              fill:gradient         });     } else      {     console.log('else');     chart.chartbackground.attr({         fill: '000000'     });     } 

in case there called else statement. think there should property chart.backgroundcolor, tried chart.chartbackground.

any idea how access background color property of chart? thx lot!

you should check chart.chartbackground.fill value.

http://jsfiddle.net/ewljj/1/

or chart.options.chart.backgroundcolor

in both examples, value true.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -