Как изменить цвет графика серии highcharts на черно-белый во время загрузки его в виде изображения?

#javascript #reactjs #highcharts

#javascript #reactjs #highcharts

Вопрос:

 I was trying to download the highcharts.js line graph in the black and white image during downloading in spite of the colors which are randomly generated in the graph. But I am not getting how can I achieve this. 
  

Ниже приведена ссылка на график.

 https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/line-basic/

I want the graph to be black and white during downloading only and I want them to stay colorful during the rendering. Right now it is downloading as a colorful image. 

Thanks in advance because I am a novice in the highcharts. I am stuck in this position. Please help me out.
  

Комментарии:

1. Что вы уже пробовали? Вы только что связали демонстрационную версию Highcharts, а не свой код.

2. Я не понимаю, как действовать дальше, вот почему я задал этот вопрос @core972.

Ответ №1:

Используйте опцию экспорта, чтобы изменить цвета по умолчанию на черный:

 exporting: {
        chartOptions: {
            colors: ['#000000', '#000000', '#000000', '#000000', '#000000'],
        }
    },
  

Вот демо

Комментарии:

1. Большое спасибо, это то, что я искал 🙂

Ответ №2:

Вы можете изменить цвета для экспорта с помощью chartOptions свойства:

 exporting: {
    chartOptions: {
        ...
    }
}
  

Живая демонстрация:http://jsfiddle.net/BlackLabel/8typuasx

Ссылка на API:https://api.highcharts.com/highcharts/exporting.chartOptions

Комментарии:

1. Спасибо за поддержку 🙂