2

How can i change the background color in angular2-highcharts? i my component i have:

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: []
  }]
};

}

template:

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

when i do this.chart.backgroundColor= "#000000"; nothing happens.

2 Answers2

0

I got some help from a co-worker and this works for me now.

saveChart(chart) {
     this.chart = chart;
     this.chart.chartBackground.css({
      color: 'rgba(225, 225, 225, 0.7)',
      fontSize: '16px'
    });
}
0
chart: {
    "events": {
        "drilldown": drillDownCallBack
    },
    "plotBackgroundColor": "black",
    "plotBorderWidth": null,
    "plotShadow": false,
    "type": "pie"
}

You can just pass "plotBackgroundColor": "black",for background color. Here is an example check this

Adrita Sharma
  • 21,581
  • 10
  • 69
  • 79
Gourav
  • 115
  • 10