Jquery Flot类别堆积条形图不堆叠 [英] Jquery Flot category stacked bar chart not stacking

查看:96
本文介绍了Jquery Flot类别堆积条形图不堆叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我遇到了Flot的问题。我有正确的所有数据,但唯一的问题是我的数据没有堆叠。我有堆栈:是的,但是我做错了什么?

So I am having an issue with Flot. I have all the data right, but the only problem is my data doesn't stack. I have stack: true, but what am I doing wrong?

这是php中三个数组的输出

Here is the output of the three arrays in php

[[Lifting 1,4],[go 2,0],[Hub,0]]

[["Lifting 1",4],["go 2",0],["Hub",0]]

[[Lifting 1 ,1],[go 2,106],[Hub,92]]

[["Lifting 1",1],["go 2",106],["Hub",92]]

[[Lifting 1,50],[go 2,24],[Hub,46]]

[["Lifting 1",50],["go 2",24],["Hub",46]]

<script type="text/javascript">

$(function() {

    var d1 = <?php echo json_encode($dataset_inb_dmg01); ?>;
    var d2 = <?php echo json_encode($dataset_inb_dmg02); ?>;
    var d3 = <?php echo json_encode($dataset_inb_dmg03); ?>;

    function plotWithOptions() {
        $.plot("#placeholder", [ d1, d2, d3 ], {
            series: {
                stack: true,
                bars: {
                    show: true,
                    barWidth: 0.6,
                    align: "center"
                }
            },
            xaxis: {
                mode: "categories",
                tickLength: 0
            }
        });
    }
    plotWithOptions();
});

</script>


推荐答案

确保在之后加载堆栈插件 你加载了类别插件。

Make sure you load the stack plugin after you load the categories plugin.

这篇关于Jquery Flot类别堆积条形图不堆叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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