【发布时间】:2018-05-29 18:54:30
【问题描述】:
这里是js小提琴highchart stacked bar stacked label issue
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
align: 'right',
style: {
color: '#838383',
fontSize:"12px",
fontWeight:"normal",
width:'60px'
}
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'John',
data: [5555555555555, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
是否可以设置条的最大长度以使 yAxis 标签不隐藏?或者我怎样才能显示完整的标签?目前如果它的值很大,它会隐藏标签的某些部分。
【问题讨论】:
-
将 stackLabels.style.whiteSpace 设置为 'nowrap' 并将 chart.style.overflow 设置为可见 - 此设置允许查看溢出的标签 jsfiddle.net/35reh42o。您还可以将最大值设置为高于您的最大数据值。
标签: highcharts label stacked-chart