How can I change the colors of my highcharts piechart?

前端 未结 8 637
不知归路
不知归路 2020-12-13 17:15

I\'m using highcharts to make a piechart but I\'m having trouble loading a custom color set for my chart.

Here is my code:

     

        
相关标签:
8条回答
  • 2020-12-13 17:55
    Highcharts.setOptions({
     colors: ['#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
    });
    

    Look the following example http://jsfiddle.net/8QufV/

    0 讨论(0)
  • 2020-12-13 17:56

    For those of you that prefer to initialize the color in the configs, you could simply put the colors in the plotOptions portion of the config object like so:

    ...,
    plotOptions: {
      pie: {
       colors: [
         '#50B432', 
         '#ED561B', 
         '#DDDF00', 
         '#24CBE5', 
         '#64E572', 
         '#FF9655', 
         '#FFF263', 
         '#6AF9C4'
       ],
       allowPointSelect: true,
       cursor: 'pointer',
       dataLabels: {
         enabled: false
       },
       showInLegend: true
     }
    },
    ...
    
    0 讨论(0)
提交回复
热议问题