Javascript jQuery Flot.js:折线图点未与x轴网格线居中
我的点与x轴的网格线不居中,如下面的屏幕截图所示: 我使用的选项如下:Javascript jQuery Flot.js:折线图点未与x轴网格线居中,javascript,jquery,flot,Javascript,Jquery,Flot,我的点与x轴的网格线不居中,如下面的屏幕截图所示: 我使用的选项如下: var options = { grid: { show: true, aboveData: false, color: "#3f3f3f", labelMargin: 10, axisMargin: 0, borderWidth: 0, borderColor: null,
var options = {
grid: {
show: true,
aboveData: false,
color: "#3f3f3f",
labelMargin: 10,
axisMargin: 0,
borderWidth: 0,
borderColor: null,
minBorderMargin: 5,
clickable: true,
hoverable: true,
autoHighlight: true,
mouseActiveRadius: 100
},
series: {
lines: {
show: true,
fill: true,
lineWidth: 2,
steps: false
},
points: {
show: true,
radius: 4.5,
symbol: "circle",
lineWidth: 3.0
}
},
legend: {
position: "ne",
margin: [0, -15],
noColumns: 0,
labelBoxBorderColor: null,
labelFormatter: function(label, series) {
// just add some space to labes
return label + ' ';
},
width: 40,
height: 1
},
colors: chartColours,
shadowSize: 0,
tooltip: true, //activate tooltip
tooltipOpts: {
content: "%s: %y.0",
xDateFormat: "%d/%m",
shifts: {
x: -30,
y: -50
},
defaultTheme: false
},
yaxis: {
min: 0,
tickDecimals:0
},
xaxis: {
mode: "time",
minTickSize: tickSize,
timeformat: tformat,
min: chartMinDate,
max: chartMaxDate
}
};
我的数据集是一个时间序列,标签值也来自同一数据集,因此日期应该与点对齐。但是,它是偏移的,而不存在此选项。我做错了什么?我从这个链接得到了解决方案 及 Flot图表似乎需要UTC格式的时间 对我来说,只需在“
xaxis
”中添加“时区:“浏览器”
”就可以了
添加后,我的“xaxis”如下所示:
xaxis: {
mode: "time",
minTickSize: [1, "day"],
timeformat: "%d-%b-%y",
timezone:"browser",
min: min date value define here,
max: max date value define here
}
你找到这个问题的答案了吗?我没有。我可能很快会再看一次,所以如果我找到了解决方案,我会把它贴在这里。