高图表中是否有一种方法可以堆叠每列具有两个值的列。不完整与已完成的项目我想要的是Aaron的一列具有未完成和已完成的值,然后是约翰斯团队的下一列具有未完成和已完成的值?在此先感谢您的帮助
我的代码如下:
$(function() {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Complete vs Incomplete Tasks (by Team)'
},
xAxis: {
categories: ['Aarons Team' /*,'Johns Team' */ ]
},
yAxis: {
min: 0,
title: {
text: 'Tasks'
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'Aarons Team',
data: [4]
}, //incomplete projects
{
name: 'Aarons Team',
data: [2]
} // completed projects
/* {name: 'Johns Team', data:[6]}, //incompleted projects
{name: 'Johns Team', data:[4]} // completed projects
*/
]
});
});
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
最佳答案
我想到了。
对于每个额外的列,您必须在上一列中放置0或NULL。
{ name: 'Aarons Team', data:[4] }, //incomplete projects
{ name: 'Aarons Team', data:[2]} // completed projects
{name: 'Johns Team', data:[0,6]}, //incompleted projects
{name: 'Johns Team', data:[0,4]} // completed projects