gpt4 book ai didi

HighCharts - 增加条形高度并减少条形间隙

转载 作者:行者123 更新时间:2023-12-02 16:51:41 25 4
gpt4 key购买 nike

尝试增加栏高度以容纳栏内的系列名称,并尝试减少系列组之间的默认间隙。我假设“series: []”部分是为了填充 JSON 返回函数。尝试了所有慷慨的 JSFiddle 示例中的许多示例,但均无济于事。我是菜鸟所以请耐心等待。有任何想法吗?到目前为止我有:http://jsfiddle.net/PeterHanekom/7ue5bkm8/1/

        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);
});

最佳答案

我认为您需要的选项是 groupPadding 和 pointWidth。例如

              groupPadding:0.1,
pointWidth:20,

http://jsfiddle.net/s3t2pL94/

关于HighCharts - 增加条形高度并减少条形间隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25559713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com