highcharts动态背景颜色问题

问题描述 投票:0回答:1

我在我的应用程序两个主题(光线暗)。我想给不同的颜色来我的图表背景和标签取决于图表的主题。我怎么能动态改变。这是我到目前为止的代码:

chart: {
   type: 'area',
   backgroundColor: '#FBFAFA', 
},
highcharts ionic3
1个回答
0
投票

您可以使用chart.update()方法并传递一个新的背景颜色有:

码:

var chart = Highcharts.chart('container', {
  chart: {
    backgroundColor: '#efefef'
  },
  plotOptions: {
    series: {
      pointStart: 2010
    }
  },
  series: [{
    data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
  }]
});


setTimeout(function() {
  chart.update({
    chart: {
      backgroundColor: '#c5c5c5'
    }
  });
}, 3000);

演示:

API参考:

© www.soinside.com 2019 - 2024. All rights reserved.