Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Highcharts Monochrome Pie Chart

Highcharts Monochrome Pie Chart

Highcharts Pie ChartHighcharts Pie Chart

The following example demonstrates a monochrome pie chart.

We learned the basic Highcharts configuration syntax in the previous chapters. Now let's look at some other configurations.


Configure

colors Configuration

Use the Highcharts.getOptions().plotOptions.pie.colors property to configure the color of each pie slice.



// Set monochrome and set default theme for all pies

Highcharts.getOptions().plotOptions.pie.colors = (function () {

   var colors = [];

   var base = Highcharts.getOptions().colors[0];

   var i;



   for (i = 0; i < 10; i += 1) {

      // 以一暗色开始并以亮色结束

      colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());

   }

   return colors;

}());

Example

Filename: highcharts_pie_monochrome.htm









Highcharts 教程 | Runoob Tutorial(runoob.com)









The output of the above example is:

Highcharts Pie ChartHighcharts Pie Chart