2014-08-30 19 views
2

您可以看看This Demo,讓我知道爲什麼情節藥水的顏色沒有從顏色選項(兩種顏色)中獲取條形顏色。正如你所看到的,這兩種顏色只有一種顏色。關於在高圖條形圖上設置顏色選項的問題

$(function() { 
    chart1 = new Highcharts.Chart({ 
     chart: { 
      renderTo: 'container', 
      type: 'bar' 
     }, 
     plotOptions: { 
      column: { 
       colorByPoint: true 
      }, 
       series: { 
       pointWidth: 50 
      } 
     }, 
     colors: [ 
      '#D9844B', 
      '#3F4539'], 
     credits: { 
      enabled: false 
     }, 
     title: { 
      text: 'Test', 
      style: { 
       color: '#2d2d2d', 
       fontWeight: 'normal', 
       fontSize: '11', 
       marginBottom: '30' 
      } 
     }, 

     xAxis: { 
      categories: ['Ecology & Economics', 'Economics Only'], 

     }, 
     yAxis: { 
      tickInterval: 50, 
      max: 300, 
      title: { 
       text: 'Number of ROR Facilities' 
      } 
     }, 
     legend: { 
      enabled: false 
     }, 
     tooltip: { 
      formatter: function() { 
       return this.x + ' <b> : ' + this.y + '</b>'; 
      } 
     }, 
     series: [{ 
      data: [29.9, 71.5], 
      dataLabels: { 
       enabled: true, 

       color: '#2d2d2d', 
       align: 'right', 
       x: -40, 
       y: 0, 
       style: { 
        fontSize: '12px', 
        fontFamily: 'Verdana, sans-serif' 
       } 
      } 
     }] 
    }); 
}); 

感謝

+0

有人可以給我一個想法來解決這個問題嗎? – 2014-08-31 10:06:16

回答

1

我認爲文件是錯誤的。它說,colorByPoint是一個酒吧/列選項,但你是正確的,它不工作。它移動到一系列選項,它的工作:

plotOptions: {    
      series: { 
      pointWidth: 50, 
      colorByPoint: true 
     } 
    }, 

更新fiddle