我正在检查Flot中的堆积图,但发现条形图中有些奇怪。
我尝试使用这个:
http://jsfiddle.net/zNXBd/41/
在此示例代码中,尝试将鼠标悬停在堆积的线上。悬停正在工作。
现在,这一次,请尝试将“线”更改为“条”,然后再次运行。
ds.push({
data:completes,
label: "Complete",
yaxis: 2,
stack:true,
bars: {
show: true,
fill: true,
order: 2,
}
});
ds.push({
data:screeners,
label: "Pre-Screened",
yaxis: 1,
bars: {
show: true,
fill: true,
order: 1,
}
});
ds.push({
data:holds,
label: "Holds",
yaxis: 2,
stack:true,
bars: {
show: true,
fill: true,
order: 3,
}
});
请注意,这些条不再可悬停。似乎这部分有问题。
您能帮我解决这个问题吗?
最佳答案
看来您的杠太细了,无法悬停触发。
您可能需要在bar选项中放入barWidth。
默认情况下,条宽为1,以x轴为单位。在时间轴上,1 = 1ms,在您的比例尺上,未表示一个1 ms宽度的条(我们只看到笔划,而不是条本身)
从文档中:
例:
bars: {
show: true,
fill: true,
order: 2,
barWidth: 1*3600*1000
}
这是您的小提琴,barwidth设置为1小时:
http://jsfiddle.net/zNXBd/42/