[英]Bar chart label alignment for all the zero values
我正在使用条形图的高图表库。 除了一件事,一切都工作正常。 当条中的所有值均为“ 0”时,对齐方式已更改为右侧。 我想使其左对齐。 对于任何非零值,它都按预期工作。
这是小提琴
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Historic World Population by Region'
},
subtitle: {
text: 'Source: <a href="https://en.wikipedia.org/wiki/World_population">Wikipedia.org</a>'
},
xAxis: {
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
},
},
yAxis: {
min: 0,
title: {
text: 'Population (millions)',
align: 'high'
},
labels: {
overflow: 'justify',
align:'left'
}
},
tooltip: {
valueSuffix: ' millions'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 80,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
credits: {
enabled: false
},
series: [{
name: 'Year 1800',
data: [0, 0, 0, 0, 0]
}]
});
任何帮助,将不胜感激。
如果所有值均为0
,则无法计算max
,因此Highcharts将在中间渲染值。 您可以通过设置yAxis.max
或yAxis.softMax
演示在左侧显示标签: https : yAxis.softMax
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.