0

我尝试动态更改图表的 plotBackgroundColor(在 highcharts 生成之后)。之前,对于很多属性,我使用(示例):

 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;

但它不起作用......有人有想法吗?

4

1 回答 1

1

使用element.attr()功能:http: //jsfiddle.net/3bQne/204/

代码:

    chart.plotBackground.attr({ 
        fill: 'white'
    });
于 2013-06-10T12:36:54.590 回答