2013-02-11 167 views
5

我正在使用條形圖(使用百分比堆疊)構建一個進度條,並且想要刪除容器中的空格/填充並僅保留沒有任何填充/頁邊空白的欄在圖表容器中。HighCharts - 刪除條形圖的填充

有沒有辦法完成這個?

Fiddle

代碼:

$(function() { 
    var chart; 
    $(document).ready(function() { 
     chart = new Highcharts.Chart({ 
      chart: { 
       renderTo: 'container', 
       type: 'bar' 
      }, 
      legend: { 
       enabled: false, 
      }, 
      title: { 
       text: '' 
      }, 
      xAxis: { 

       lineWidth: 0, 

       labels: { 
        enabled: false 
       }, 
       minorTickLength: 0, 
       tickLength: 0 
      }, 
      yAxis: { 
       min: 0, 
       title: { 
        text: '' 
       }, 
       lineWidth: 0, 
       gridLineWidth:0, 
       lineColor: 'transparent', 
       labels: { 
        enabled: false 
       }, 
       minorTickLength: 0, 
       tickLength: 0 
      }, 
      tooltip: { 
       enabled: false 
      }, 
      plotOptions: { 
       bar: { 
        stacking: 'percent' 

       }, 
       series: { 
      pointPadding: 0, 
      groupPadding: 0,  
     } 
      }, 

      series: [{ 
       name: 'max', 
       data: [40], 
       color: 'white' 
      }, { 
       name: 'current', 
       data: [60], 
       color: 'green' 
      }] 
     }); 
    }); 

}); 

回答