jquery - float 条形图 : bars overlapping on time axis issue

标签 jquery time flot bar-chart overlapping

我正在尝试根据时间轴绘制费用数据,并且我发现如果数据条显示同一日期的数据,则数据条会重叠。我期望图表显示彼此相邻的条形,但事实并非如此。查看sample of code at this link ...

$.plot($("#placeholder"), newJson, 
{
    bars: {
        show: 1,
        barWidth: 24 * 60 * 60 * 1000 * 10
    },
    xaxis: { mode:"time" }
});

enter image description here

最佳答案

不幸的是,如果不使用某种插件,这在 flot 中是不可能的。我建议您使用stacking plugin获得垂直堆栈,或像 orderBars 这样的外部插件.

在每个系列中,您都可以向每个系列添加一个选项,指定它应该堆叠/排序。或者如果您希望它适用于所有内容,则可以选择条形图的整体系列选项。

$.plot($("#placeholder"), newJson, 
    {bars: { order:1, show: 1, barWidth: 24 * 60 * 60 * 1000 * 10 },
     xaxis: { mode:"time" }
});

这是一个工作示例:http://jsfiddle.net/ryleyb/A8yNV/7/

关于jquery - float 条形图 : bars overlapping on time axis issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20264954/

相关文章:

php - 使用 jquery 和 php 将数据与上传图像一起保存到 mysql

php - 按预期打印数组中不同的值

javascript - jQuery 箭头键功能在我的表格最后一行添加文本框时停止

java - 将 mySQL localTime 更改为当前时间

sql-server - 如何在 SQL Server 中将纪元时间与 24 小时前进行比较?

javascript - fllot 2nd yaxis 线未正确绘制

javascript - var $view = $().find('.something) 的含义

java - 如何从 Locale 获取当前时间和时区?

javascript - jQuery Flot : Set width of chart (without labels)

javascript - 将 JS 图表库与 NodeJS 结合使用