2

Simply speaking that I have 2 values of ActualCost and BudgetCost, I made a Clustered Columns chart to display their values. Now I made two series for each of them (I want to make legends for them). In each series why I must have to use two values in Array?

When I am using in .addSeries([]) the code {y:0,tooltip:0}, it work fine an displaying both bars, and when I am not using it, it displays only single bar. Can somebody explain why should I have to use this (i.e {y:0,tooltip:0}).

I wrote a code for it and its working fine, code snippet below;

    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.TitlePane");
    dojo.require("esri.dijit.Popup");
    dojo.require("dojox.charting.Chart2D");
    dojo.require("dojox.charting.plot2d.ClusteredColumns");
    dojo.require("dojox.charting.action2d.Tooltip");
    dojo.require("dojo.number");
    dojo.require("dijit.layout.TabContainer");
    dojo.require("dojox.charting.themes.Wetland");
     //...
        function getTextContent(graphic) 
          var ActualCost;
          var BudgetCost;
             (parseFloat(jsonobject.Data.Actual_Total_Cost) == 'NaN') ? ActualCost=0 :
             ActualCost=parseFloat(jsonobject.Data.Actual_Total_Cost);
             (parseFloat(jsonobject.Data.Current_Budget) == 'NaN') ? BudgetCost=0 :
             BudgetCost=parseFloat(jsonobject.Data.Current_Budget);

             //display a dojo pie chart for the Project Cost
             var CostPane = new dijit.layout.ContentPane({
                title: "Project Cost"
               });
        tc.addChild(CostPane);
        var costDiv = dojo.create("div", 
        { id:"cost",width: 300, height: 300}, dojo.create('div'));
        var barchart = new dojox.charting.Chart2D(costDiv);
        dojo.addClass(barchart,'chart');
        barchart.setTheme(dojo.getObject("dojox.charting.themes.Wetland"));
        barchart.addPlot("default",{type: "ClusteredColumns",markers: true,gap: 10});
        //barchart.addAxis("x");
        barchart.addAxis("y", {vertical: true});

        new dojox.charting.action2d.Highlight(chart, "default");
        new dojox.charting.action2d.Tooltip(chart,"default");
        new dojox.charting.action2d.MoveSlice(chart,"default");

//Why using {y:0,tooltip:0} in the array??


    barchart.addSeries("Actual Cost", [ {y:ActualCost,tooltip:'Actual Cost =' +
 Math.round(ActualCost*100)/100}, {y:0,tooltip:0}] );
        barchart.addSeries("Current Budget", [ {y:BudgetCost,tooltip:'Budget Cost =' +
 Math.round(BudgetCost*100)/100}, {y:0,tooltip:0}] );
        barchart.render();
        CostPane.set('content',barchart.node);
        deferred.callback(tc.domNode);
                                            },

Can some one help? Thank you

AbdulAziz
  • 5,868
  • 14
  • 56
  • 77
  • Perhaps recreating your issue in jsFiddle (http://jsfiddle.net/) would allow people to easily see your issue. – GavinR Oct 08 '12 at 20:54

1 Answers1

0

addSeries method accepts three arguments, the second one is the array of data, that is why you need use array. It indicates the data in the column chart.

qunshan
  • 57
  • 3