添加正在使用的代码段
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['M1']
},
yAxis: {
type: 'datetime',
min: 1420063200000,
max: 1420063920000,
title: {
text: 'Total fruit consumption'
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'Idle',
data: [1420063500000]
}, {
name: 'Idle1',
data: [1420064200000]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
答案 0 :(得分:0)
您添加了最小和最大限制,因为该数据已超出限制,因此它不会向您显示其他图表。更改最小值和最大值或更改数据。
我尝试了相同的示例,但没有min和max限制其正常工作。
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['M1']
},
yAxis: {
type: 'datetime',
title: {
text: 'Total fruit consumption'
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'Idle',
data: [1420063500000]
}, {
name: 'Idle1',
data: [1420064200000]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
答案 1 :(得分:0)
您的数据超出了min
和max
的范围。值:1420063500000
和1420064200000
堆叠在一起,创建2840127700000
值。您可能想使用:
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'Idle',
data: [700000]
}, {
name: 'Idle1',
data: [1420063500000]
}]
实时演示: http://jsfiddle.net/BlackLabel/ncvk7pwt/
API参考: https://api.highcharts.com/highcharts/series.bar.stacking