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);
});
你可以分享你的代碼的jsfiddle? – Duniyadnd 2014-08-28 23:54:29
您是否嘗試過使用'groupPadding'?另外,如果你能展示模型,那麼預期的結果將會很棒! – 2014-08-29 10:12:37