[英]Highcharts multiple data points between xAxis
我正在使用Highcharts,并试图在xAxis上的任何点之间获取多个点。 (例如,我想在10月到11月之间获得4分。)我该怎么做?
我尝试在y:上添加[]以指定多个值,但这没有用。 我似乎什么都无法工作,在highcharts网站上也找不到任何示例。
$(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轴值
data: [{
y: 3,
x: Date.UTC(2012, 9, 9)
date: 'October 9th, 2012',
unlocked: 1,
potential: 1,
}, {
您还需要删除xaxis类别,并使xa键入“ datetime”,例如,此处为http://www.highcharts.com/demo/spline-irregular-time
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.