2014-08-28 105 views
6

尝试增加酒吧高度以适应酒吧系列名称并试图减少系列组之间的默认差距。 “系列:[]”部分是,我假设为JSON返回函数来填充。从所有JSFiddle慷慨的例子中尝试了很多例子都无济于事。我是一个小菜,所以请耐心等待。有任何想法吗?到目前为止,我有:http://jsfiddle.net/PeterHanekom/7ue5bkm8/1/HighCharts - 增加酒吧高度并减少酒吧差距

 var options = { 
      chart: { 
       renderTo: 'container', 
       type: 'bar' 
      }, 
      colors: ['#00B9B9', '#527CED', '#A7D36B', '#B9B900', '#0097FF', '#400040', '#EA4D00', '#336699', '#8080C0', '#ADA870'], 
      title: { 
       text: 'Cluster Totals', 
       x: -20 //center 
      }, 
      subtitle: { 
       text: 'Dept - Branch', 
       x: -20 
      }, 
      xAxis: { 
       categories: [] 

      }, 
      yAxis: { 
       min: 0, 
       max: 100,     
       title: { 
        text: 'Percentage' 
       }, 
       labels: { 
        overflow: 'justify' 
       } 
      }, 
      tooltip: { 
       formatter: function() { 
         return '<b>'+ this.series.name +'</b><br/>'+ 
         this.x +': '+ this.y; 
       } 
      }, 
      legend: { 
       align: 'center', 
       borderWidth: 0 
      }, 
      plotOptions: { 
       bar: {    
       stacking: 'normal', 
       pointWidth: 20, 
       pointPadding: 0, 
       cursor: 'pointer', 
       point: { 
        events: { 
         click: function() { 
          alert('later drilldown events'); 
         } 
        } 
       dataLabels: { 
        enabled: true, 
        inside:true, 
        useHTML: true, 
        align: 'left', 
        color: 'white', 
        style: { 
         fontWeight: 'bold' 
        },      
        verticalAlign: 'middle',      
        formatter: function() { 
         if (this.series.name) 
         return '<span style="color:black; height: 25px;">' + this.series.name + ' = ' + this.y + '</span>'; 
         else return ''; 
        } 
       } 
       } 
      }, 
      series: [] 
     } 

     $.getJSON("./services/get360Pivot.php?s_Search=" + sOperatorSearch, function(json) 
     { 
     options.xAxis.categories = json[0]['data']; 
     options.series[0] = json[1]; 
     options.series[1] = json[2]; 
     options.series[2] = json[3]; 
     options.series[3] = json[4]; 
     chart = new Highcharts.Chart(options); 
     });   
+1

你可以分享你的代码的jsfiddle? – Duniyadnd 2014-08-28 23:54:29

+0

您是否尝试过使用'groupPadding'?另外,如果你能展示模型,那么预期的结果将会很棒! – 2014-08-29 10:12:37

回答