Flot:使用多个堆叠的条形图命令在整个屏幕上堆叠条形图 [英] Flot: Order the stacking of the bars throughout screen with multiple stacked bar charts

查看:95
本文介绍了Flot:使用多个堆叠的条形图命令在整个屏幕上堆叠条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JSFIDDLE

问:,我需要订购堆叠的条形图,以便在具有多个堆叠的条形图的整个屏幕中保持一致.
例如,如果一个条形从顶部到底部087、084、080、01-02、00到顶部都堆叠了标签,则所有其他图表中的位置都应该相同

Q: I need to order the stacked bars so it'll be consistent throughout a screen with multiple stacked bar charts.
e.g if one bar has stacked labels starting with the top to bottom 087, 084, 080, 01-02, 00 then the position should be the same in all the other charts

我尝试过:

chartData.sort(function(a, b){ 
    return a.label.localeCompare(b.label);
});

但是似乎不能在一栏内堆叠标签.

But it does not seem to work for stacked labels in one bar.

推荐答案

当图表中的一个数据系列在特定x值处存在间隙时,堆叠会出现问题.例如,图表2中的中间条(x = 2):

There is a problem with the stacking when one data series in the chart has a gap at a specific x value. For example the middle bar (at x = 2) in chart 2:

{
    label: "084",
    data: [
        [0, 3],
        [1, 12],
        [2, 0], // this was missing, after adding it, the stacking works
        [3, 53],
        [4, 13]
    ]
}

这篇关于Flot:使用多个堆叠的条形图命令在整个屏幕上堆叠条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆