[英]Flot bar chart: bars overlapping on time axis issue
I am trying to plot expense data against time axis, and I see the data bars are overlapping if they are showing data for the same date. 我正在尝试针对时间轴绘制费用数据,并且如果它们显示的是同一日期的数据,我会看到数据栏重叠。 I was expecting the graph to show the bars asjascent to each other but that is not the case.
我期望图形显示彼此相邻的条,但事实并非如此。 See a sample of code at this link ...
在此链接中查看代码示例 ...
$.plot($("#placeholder"), newJson,
{
bars: {
show: 1,
barWidth: 24 * 60 * 60 * 1000 * 10
},
xaxis: { mode:"time" }
});
Unfortunately, that isn't possible in flot without using some sort of plugin. 不幸的是,如果不使用某种插件,这是不可能的。 I suggest you either use the stacking plugin to get a vertical stack, or an external plugin like orderBars .
我建议您要么使用堆栈插件来获取垂直堆栈,要么使用诸如orderBars之类的外部插件。
In each of them, you add an option to each series specifying that it should be stacked/ordered. 在每个系列中,您都向每个系列添加一个选项,以指定应对其进行堆叠/排序。 Or to the overall series options for bars if you want it to apply for everything.
或者,如果您想将其应用于所有内容,则选择栏的整体系列选项。
$.plot($("#placeholder"), newJson,
{bars: { order:1, show: 1, barWidth: 24 * 60 * 60 * 1000 * 10 },
xaxis: { mode:"time" }
});
Here's a working example: http://jsfiddle.net/ryleyb/A8yNV/7/ 这是一个工作示例: http : //jsfiddle.net/ryleyb/A8yNV/7/
I've just solved an issue with the ORDER property : it does not work if one of the serie has a NULL value. 我刚刚解决了ORDER属性的问题:如果其中一个系列具有NULL值,它将不起作用。 Indeed, I was using NULL value to avoid a get a tiny (0) line for the serie, but in this case the following order of the stacks are completely disturb.
确实,我使用NULL值来避免对意甲获得很小的(0)行,但是在这种情况下,以下顺序的堆栈完全被打乱了。 By setting a 0 (ZERO) instead of NULL : all is okay.
通过将0(零)设置为NULL:一切正常。
Note : the same problem with or without the "orderBars plugin". 注意:带有或不带有“ orderBars插件”的相同问题。
Hope this will help. 希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.