0
我正在使用Highcharts,並試圖在xAxis上的任意點之間獲取多個點。 (例如,我想在10月到11月間得4分。)我該怎麼做?Highcharts xAxis之間的多個數據點
我已經嘗試在y上添加[]來指定多個值,但那不起作用。我似乎無法得到任何工作,我可以在高層網站上找到任何這方面的例子。
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'area'
},
title: {
text: "Title"
},
credits: {
enabled: false
},
xAxis: {
categories: ["October", "November", "December", "January", "February", "March"],
tickmarkPlacement: 'on',
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'Counts'
},
labels: {
formatter: function() {
return this.value;
}
}
},
tooltip: {
formatter: function() {
return '<strong>Count:</strong> ' + this.y + '<br><strong>Date:</strong> ' + this.point.date;
}
},
plotOptions: {
area: {
stacking: 'normal',
lineColor: '#666666',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#666666'
}
}
},
series: [{
name: 'Views',
data: [{
y: 3,
date: 'October 9th, 2012',
unlocked: 1,
potential: 1,
}, {
y: 5,
date: 'October 12th, 2012',
unlocked: 1,
potential: 2,
}, {
y: 7,
date: 'October 14th, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 18th, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 22nd, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 23rd, 2012',
unlocked: 1,
potential: 3,
}, ]
}, {
name: 'Replies',
data: [{
y: 3,
date: 'October 9th, 2012',
unlocked: 1,
potential: 1,
}, {
y: 5,
date: 'October 12th, 2012',
unlocked: 1,
potential: 2,
}, {
y: 7,
date: 'October 14th, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 18th, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 22nd, 2012',
unlocked: 1,
potential: 3,
}, {
y: 7,
date: 'October 23rd, 2012',
unlocked: 1,
potential: 3,
}, ]
}],
exporting: {
enabled: false
}
});
});
});
應該是'x',而不是''X'。 – 2013-03-21 11:42:58
完美。這正是我所期待的。謝謝! – 2013-03-21 20:17:33
請注意,JavaScript的月份從0到11.我更新了我的anwer。 – SteveP 2013-03-22 09:16:26