<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
这是JS:
$(function() {
$('#container').highcharts({
/*
chart: {
type: 'columnrange'
},*/
xAxis: {
categories: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11']
},
legend: {
enabled: false
},
/* plotOptions: {
series: {
pointWidth: 3
}
},*/
series: [{
name: 'Temperatures',
data: [
[0,-9.7, 9.4],
[1,-9.7, 6.5],
[2,-3.5, 9.4],
[3,-1.4, 19.9],
[4,0.0, 22.6],
[5,2.9, 29.5],
[6,9.2, 30.7],
[7,7.3, 26.5],
[8,4.4, 18.0],
[9,-3.1, 11.4],
[10,-5.2, 10.4],
[11,-13.5, 9.8]
],
pointWidth: 0,
type:'columnrange',
}, {
name: 'Min-Temperatures',
type: 'scatter',
//data: [-9.7,-8.7,-3.5,-1.4,0.0, 2.9, 9.2, 7.3, 4.4, -3.1,-5.2,-13.5],
data: [
[0, -9.7],
[1, -9.7],
[2, -3.5],
[3, -1.4],
[4, 0.0],
[5, 2.9],
[6, 9.2],
[7, 7.3],
[8, 4.4],
[9, -3.1],
[10, -5.2],
[11, -13.5]
]
}]
});
});
这里有小提琴,我正在尝试创建一个最低点为散点图的列范围图表。不知何故,散点图点不希望与列范围图表对齐,它稍微左对齐。
我尝试使用pointWidth属性,但它没有给出一致的结果。
我是否有一些其他属性可能会让这两个图表水平对齐。