如何让我的图表从2010年开始,或更具体地从日期02-02-2010开始, 我制作了这张图表,但我不知道如何继续http://jsfiddle.net/P87XF/2/
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['John']
},
yAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%d-%m-%Y'
},
title: {
text: 'Total fruit consumption'
}
},
legend: {
backgroundColor: '#FFFFFF',
reversed: true
},
plotOptions: {
bar:{
stacking: 'normal',
pointInterval: 24 * 3600 * 1000
}
},
series: [{
name: 'Manager',
data: [Date.UTC(2014, 20, 01)]
}, {
name: 'Developer',
data: [Date.UTC(2012, 20, 01)]
}, {
name: 'Tester',
data: [Date.UTC(2010, 20, 01)]
}]
});
});
答案 0 :(得分:1)
我很难理解堆叠日期的目的是什么?这对我来说很奇怪,所以我禁用了堆叠并使用了列范围类型,这里是实时效果:http://jsfiddle.net/P87XF/3/
$(function () {
$('#container').highcharts({
chart: {
inverted: true,
type: 'columnrange'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['John']
},
yAxis: {
min: Date.UTC(2010, 1, 2),
type: 'datetime',
dateTimeLabelFormats: {
day: '%d-%m-%Y'
},
title: {
text: 'Total fruit consumption'
}
},
legend: {
backgroundColor: '#FFFFFF',
reversed: true
},
plotOptions: {
bar:{
//stacking: 'normal',
//pointInterval: 24 * 3600 * 1000
}
},
series: [{
name: 'Manager',
data: [[Date.UTC(2010, 1, 2), Date.UTC(2014, 20, 01)]]
}, {
name: 'Developer',
data: [[Date.UTC(2010, 1, 2), Date.UTC(2012, 20, 01)]]
}, {
name: 'Tester',
data: [[Date.UTC(2010, 1, 2), Date.UTC(2010, 20, 01)]]
}]
});
});