Naga K
Naga K

Reputation: 753

Highcharts - Export with background color

I am trying to export my chart , with "white" background color. But always it is rendered with background as black (black color is nowhere in my page/code actually). I don't know from where the black color comes during download. Can someone help please. Attaching the "exporting" tag below

exporting: {
                chartOptions: { // specific options for the exported image
                    plotOptions: {
                        series: {
                            dataLabels: {
                                enabled: true
                            }
                        },
                        chart: {
                            events: {
                                load: function () {
                                    globalBackground = '#fff';
                                    this.plotBackground.attr({
                                        fill: globalBackground
                                    });
                                }

                            }
                        }
                    }
                },
                fallbackToExportServer: false,
                sourceWidth: 600,
                sourceHeight: 400
            }

Upvotes: 1

Views: 3003

Answers (1)

yaniamac
yaniamac

Reputation: 51

Probably you have chart backgroundColor = null. It means your chart has a transparent background. While exporting jpeg Highcharts renders transparent background as black. If you want to change the color while exporting set background color in exporting object.

exporting: {
  chartOptions: {
    chart: {
      backgroundColor: '#9E9E9E'
    }
  }
}

Upvotes: 5

Related Questions