简体   繁体   中英

flot comparison bar chart

I'm trying to produce a chart in Flot that has multiple stacked bars next to each other for one data set, and a second set of stacked bars as a second data set shown underneath the main chart but off at an angle. The picture below shows what I'm after

我多么希望它看起来

Is there any way of doing this easily? I know there is a plugin that lets me put the bars next to each other but that's not really what I'm after.

I've already got it rendering one data set how I want but I don't know how to go about doing the second data set.

You could use a couple of div s and some css to do the stacking. Just put one graph in each div and then absolutely position them within a wrapper div:

<div id="graph_wrap">
    Comparison Chart
    <div id="graph1"></div>
    <div id="graph2"></div>
</div>

CSS:

#graph_wrap {
    width: 700px;
    height: 400px;
}

#graph1, #graph2 {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 600px;
    height: 300px;
    margin: 50px;
    z-index: 2;
}

#graph2 {
    top: -15px;
    left: 15px;
    z-index: 1;
}

Example: http://jsfiddle.net/jtbowden/q4N4M/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM