views:

62

answers:

1

Any sample code for chart with multiple bars using flot ??alt text

similar to this example . The given patched files are not working for me. Anywhere I can download the latest files for multi bar graph.

Update

I am sure Flot is a very good library but plugins/add-ons are not available easily and the examples given on the website are very basic, so I decided to use jqPlot instead

A: 

You have to treat each bar as it's own data series, so if you see 11 bars you need to create 11 data series.

Here's a sample code for 2 bars.

<script id="source" language="javascript" type="text/javascript">

$(function () {

var d1 =[0, 2];
var d2 =[1,3];

var startData = [
    {   //first series
        label:"d1",
        data: [d1],
        bars:{
            show: true,
            fill: true,
            fillColor: "red"
        }
    },
    {   //second series
        label:"d2",
        data: [d2],
        bars:{
            show: true,
            fill: true,
            fillColor: "blue"
        }
    }
];

var option={
        series: {
                bars:{
                        show: true,
                        fill: true
                }
        },
        grid: {
                hoverable: true,
                clickable: true
        },
        yaxis: { ticks: 5 }
    };

$.plot($("#placeholder"),startData,option  );

});

Gene
I will give it a try. Thanks