这是我的flot jquery代码:
$.plot("#area-graph-hi", [{
data: [[0, -1.0], [1, 0.17], [2, 0.0], [3, 1.0], [4, 0.67], [5, -1.33], [6, -2.0], [7, 1.67], [8, 0.0], [9, 1.67], [10, 1.67]],
yaxis: 1,
color: "#3261ab",
label: "Performance of the area",
bars: { show: true, barWidth: 0.5, align: "center" }
},{
data: [[0, 0], [1, 1.0], [2, 1.0], [3, 2.0], [4, 1.0], [5, 1.0], [6, 3.0], [7, 3.0], [8, 0.0], [9, 2.0], [10, 0.0]],
yaxis: 2,
color: "#1e8052",
label: "Combined flooding event severity scenarios",
bars: { show: true, barWidth: 0.5, align: "center" }
}
],{
grid: {
hoverable: false,
clickable: false
},
xaxis:{
ticks: [[0,0], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"]]
},
yaxis: {
tickDecimals: 0,
},
axisLabels: {
show: true
},
xaxes: [{
axisLabel: 'Year of simulation',
axisLabelPadding: 30
}],
yaxes: [{
position: 'right',
axisLabel: 'Performance of the area'
},{
position: 'left',
alignTicksWithAxis: 1,
axisLabelPadding: 20,
axisLabel: 'Combined flooding event severity scenarios'
}]
});
问题是我无法对齐两个x轴。如果我这样做,将两个x轴对齐,我无法在右轴上显示标签。我做错了什么?
(这是当前结果的图片:https://dl.dropboxusercontent.com/u/2423935/flot.jpg)