2013-06-10 2 views
0

하이 차트 생성 후 내 차트의 plotBackgroundColor를 동적으로 변경하려고합니다.Highcharts가 plotBackgroundColor를 동적으로 변경합니다.

chart.options.plotOptions.bar.dataLabels.format = '{y} meters'; \n"; 
chart.options.tooltip.valueSuffix = 'meters'; \n"; 

그래서, 같은 방식으로, 내 plotBackground을 변경하려면 : 전에 속성을 많이, 나는 (예)를 사용

var gradient = { 
    linearGradient: [0,400,0,0], 
    stops: [ 
    [0, 'yellow'], 
    [1, 'black'] 
    ] 
}; 
chart.options.chart.plotBackgroundColor = gradient; 

을하지만 그것은 작동하지 않습니다. 누군가가 생각을 가지고 있니?

답변

1

사용 element.attr() 기능 : http://jsfiddle.net/3bQne/204/

코드 :

chart.plotBackground.attr({ 
     fill: 'white' 
    }); 
+0

고마워요! 나는 이처럼 "요소"를 사용하지 않을 것이라고 생각했다. – nayfun

관련 문제