【发布时间】:2018-09-05 09:25:49
【问题描述】:
我正在尝试实现类似于 2014 年专栏的目标,但我还没有找到一种方法来提供这样的分层。 This 是我迄今为止所拥有的。
我需要制作一个看起来像 2014 年列或 2015 年列的堆叠柱形图。(可行)
第 2014 列的问题是我无法找到任何属性来提供(负)边距以实现上述结果。
2015 列的问题是我无法单独为左上角和右上角添加边框半径。
由于fiddle的链接必须附上代码
Highcharts.chart('container', {
chart: {
type: 'column',
spacingBottom: 0
},
title: {
text: ''
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
offset: 7,
lineWidth: 0,
tickLength: 0
},
yAxis: {
min: 0,
title: {
text: ''
},
stackLabels: {
enabled: false,
style: {
fontWeight: 'bold',
color: 'gray'
}
},
visible: false
},
legend: {
align: 'center',
verticalAlign: 'bottom',
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
series: {
},
column: {
stacking: 'normal',
borderWidth: 0,
borderRadius: 5,
dataLabels: {
enabled: true,
color: 'white'
}
}
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2],
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
【问题讨论】:
标签: javascript highcharts stacked-chart