2014-08-28 26 views
6

Cố gắng tăng chiều cao thanh để chứa tên chuỗi bên trong thanh và cố gắng giảm khoảng cách mặc định giữa nhóm hàng. Phần "series: []" là, tôi giả sử cho hàm trả về JSON để điền. Đã thử nhiều ví dụ từ tất cả các ví dụ JSFiddle hào phóng không có kết quả. Tôi là một noob vì vậy hãy kiên nhẫn. Ý tưởng nào? Cho đến nay tôi có: http://jsfiddle.net/PeterHanekom/7ue5bkm8/1/HighCharts - tăng chiều cao thanh và giảm khoảng cách thanh

 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

bạn có thể chia sẻ mã của bạn trong jsfiddle? – Duniyadnd

+0

Bạn đã thử sử dụng 'groupPadding' chưa? Ngoài ra, nếu bạn có thể hiển thị mockup kết quả mong đợi sẽ là tuyệt vời! –

Trả lời

Các vấn đề liên quan