Jquery flot X2轴日期布局未与X1X轴对齐
X2轴日期与X1轴时间不一致。 x2axis标签是MM dd格式的日期,应与x1axis中设置的时间对齐,即一小时。。 但这张8:00放映,这张应该是00:00Jquery flot X2轴日期布局未与X1X轴对齐,jquery,flot,Jquery,Flot,X2轴日期与X1轴时间不一致。 x2axis标签是MM dd格式的日期,应与x1axis中设置的时间对齐,即一小时。。 但这张8:00放映,这张应该是00:00 var plot = $.plot('#divPlaceholder', [ { label: itemKey[0], data: itemValue[0], color: '#4bb2c5' }, { label: itemKey[1], data: itemValue[1], color: '#c5b47f' } ]
var plot = $.plot('#divPlaceholder', [
{ label: itemKey[0], data: itemValue[0], color: '#4bb2c5' },
{ label: itemKey[1], data: itemValue[1], color: '#c5b47f' }
], {
series: {
lines: { show: true },
points: { show: true }
},
xaxis: {
mode: "time",
position: "top",
min: minVal, // this is current day - 24 hours
max: maxVal, // this is current date + 1 hours
timeformat: tickFormat,
tickSize: interval,
twelveHourClock: true,
zoomRange: [0.1, 10]
},
x2axis:{
show:true,
mode:'time',
position:'top',
timeformat:'%b-%d',
tickSize: [1, 'day'],
axisLabel: 'Lab Results',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 16,
axisLabelFontFamily: "Verdana, Arial, Helvetica, Tahoma, sans-serif",
axisLabelPadding: 0
},
yaxis: {
min: 0,
panRange:[-10, 100]
},
grid: {
hoverable: true,
clickable: true,
backgroundColor: 'gray'
},
zoom: {
interactive: false
}
});
如果在添加%H时看到8:00,则它们排列正确;这只是在一个你截短的小时时,生产标签。如果您想让他们准确地排列日期,那么您需要确保时间戳都在00:00
查看文档中的讨论,并搜索有关Flot中时间和时区的其他StackOverflow问题。如果将%b-%d更改为%b-%d-%H,即添加小时,会发生什么情况?换句话说,您确定x2轴的刻度真的在00:00吗?如果我将x2设置为%b-%d%H,它也会显示8:00