var gtbar = null;

function tablebarchart() {
    // setup the graph
    if (CanvasGraph.isSupported("fromtable")) {
        gtbar = new CanvasGraph("fromtable");    
        gtbar.padding = {top: 10, left: 50, bottom: 30, right: 20};
        gtbar.fontSize = 8;
        gtbar.xtickSeparation = 80;
        
        gtbar.setDatasetFromTable("squares", $("datatable"), 0, 1);
        gtbar.setDatasetFromTable("factorial", $("datatable"), 0, 2);        
        gtbar.setDatasetFromTable("root", $("datatable"), 0, 3);                
        
        gtbar.drawBarChart({"factorial": Color.blueColor(),
                            "squares": Color.redColor(),
                            "root": Color.greenColor()});
    }
}   

addLoadEvent(tablebarchart);

