在Highcharts中显示标签堆栈标签
我在显示堆栈标签值(直方图)时遇到问题,事实上,堆栈列标签不显示,当列总和在yAxis上有接近值时,我上传了(屏幕截图和代码): 谢谢你的帮助在Highcharts中显示标签堆栈标签,highcharts,Highcharts,我在显示堆栈标签值(直方图)时遇到问题,事实上,堆栈列标签不显示,当列总和在yAxis上有接近值时,我上传了(屏幕截图和代码): 谢谢你的帮助 Highcharts.chart('container'{ 图表:{ 类型:“列” }, 标题:{ 文本:“堆叠柱形图” }, xAxis:{ 类别:[‘苹果’、‘橘子’、‘梨’、‘葡萄’、‘香蕉’] }, 亚克斯:{ 标题:{ 正文:“水果总消费量” }, 堆叠标签:{ 启用:对, 风格:{ fontWeight:'粗体', 颜色:(Highchar
Highcharts.chart('container'{
图表:{
类型:“列”
},
标题:{
文本:“堆叠柱形图”
},
xAxis:{
类别:[‘苹果’、‘橘子’、‘梨’、‘葡萄’、‘香蕉’]
},
亚克斯:{
标题:{
正文:“水果总消费量”
},
堆叠标签:{
启用:对,
风格:{
fontWeight:'粗体',
颜色:(Highcharts.theme&&Highcharts.theme.textColor)| |“灰色”
}
}
},
图例:{
对齐:“右”,
x:-30,
垂直排列:“顶部”,
y:25,
浮动:是的,
背景颜色:(Highcharts.theme&&Highcharts.theme.background2)| |“白色”,
边框颜色:“#CCC”,
边框宽度:1,
影子:错
},
工具提示:{
headerFormat:“{point.x}
”,
pointFormat:“{series.name}:{point.y}
总计:{point.stackTotal}”
},
打印选项:{
专栏:{
堆叠:“正常”,
}
},
系列:[{
姓名:'约翰',
数据:[5470156762425449444620473],
堆栈:“x”
}, {
姓名:'简',
数据:[547015276236879687282761],
堆栈:“y”
}]
});
这是因为默认情况下stackLabels.allowOverlap=false
。将此属性设置为true,您将看到所有标签:
stackLabels: {
enabled: true,
allowOverlap: true,
rotation: 0,
style: {
fontWeight: 'bold',
fontSize: '9px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
演示:
stackLabels: {
enabled: true,
allowOverlap: true,
rotation: 0,
style: {
fontWeight: 'bold',
fontSize: '9px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}