2017-06-21 345 views
1

我怎樣才能改變angular2-highcharts的背景顏色? 我我的分量,我有:更改背景顏色

chart: any; 
saveChart(chart) { 
    this.chart = chart; 
} 

    constructor(
private eventManager: EventManager, 
private locationService: LocationService, 
private route: ActivatedRoute, 
private alertService: AlertService 

){

this.options = { 
    title: { text: 'Senaste dygnet' }, 
    xAxis: { 
    type: 'datetime', 

    title: { 
     text: 'Tid' 
    } 
    }, 
    yAxis: { 
    title: { 
     text: 'Temperatur' 
    } 
    }, 
    series: [{ 
    name: 'Vattentemperatur', 
    data: [] 
    }] 
}; 

}

模板:

<chart [options]="options" (load)="saveChart($event.context)"></chart> 

當我這樣做this.chart.backgroundColor = 「#000000」 ; 沒有任何反應。

回答

0

我從一位同事一些幫助,現在這對我的作品。

saveChart(chart) { 
    this.chart = chart; 
    this.chart.chartBackground.css({ 
     color: 'rgba(225, 225, 225, 0.7)', 
     fontSize: '16px' 
    }); 
} 
0

圖:{ 「事件」:{ 「明細」:drillDownCallBack }, 「plotBackgroundColor」: 「黑」, 「plotBorderWidth」:空, 「plotShadow」:假的, 「類型「:‘餡餅’ }

你可以通過‘plotBackgroundColor’:‘黑’,背景色下面是一個例子檢查該

+0

https://jsfiddle.net/gourav012/4ueLkze9/4/ – Gourav