AnsweredAssumed Answered

Adding Chart to InfoWindow

Question asked by PinnGIS on Apr 16, 2013
Latest reply on Apr 17, 2013 by PinnGIS
I'm trying to add a chart to an InfoTemplate but I can't seem to get it to return the chart.  Here is my code:

dojo.require("dojox.charting.themes.Julie"); dojo.require("dojox.charting.Chart2D"); dojo.require("dojox.charting.plot2d.Pie"); dojo.require("dojox.charting.action2d.Highlight"); dojo.require("dojox.charting.action2d.MoveSlice"); dojo.require("dojox.charting.action2d.Tooltip");  //Setting the InforTemplate for Layer var mtenTemplate = new esri.InfoTemplate(); mtenTemplate.setTitle("Mining Tenement ${tenid}"); mtenTemplate.setContent(getWindowContent);  function getWindowContent(graphic) {      var c = dojo.create("div", {         id: "demoChart"     }, dojo.create('div'));      var chart = new dojox.charting.Chart2D(c);          chart.setTheme(dojox.charting.themes.Julie);     chart.addPlot("default", {         type: "Pie",         radius: 70,         htmlLabels: true     });     chart.addSeries("Percentage of Tenement Covered by DIA Sites", [{         y: graphic.attributes.DIA_Perc,         tooltip: graphic.attributes.DIA_Perc,         text: 'DIA Sites Area'     }, {         y: graphic.attributes.Not_DIA_P,         tooltip: graphic.attributes.Not_DIA_P,         text: 'Area Not Covered'     }]);     new dojox.charting.action2d.Highlight(chart, "default");     new dojox.charting.action2d.Tooltip(chart, "default");     new dojox.charting.action2d.MoveSlice(chart, "default");      return "<b>Holder</b> " + graphic.attributes.holder1 +  "<br/><b>Tenement ID:</B> " + graphic.attributes.tenid + "<br/><b>Tenement Status:</b> " + graphic.attributes.tenstatus +  "<br/><b>Tenement Type:</b> " + graphic.attributes.type + "<br/><b>Tenement Area sqKm:</b> " + graphic.attributes.Area_sqKm +  "<br/><b>Number of DIA Sites:</b> " + graphic.attributes.DIA_S_Num + "<br/><b>DIA Sites Area sqKm:</b> " + graphic.attributes.DIA_S_Area +  "<br/><br/><b>Area Distribution</b><hr/>" + c; }

My function returns the contents of the InfoWindow where I want the chart to be at the bottom.  I know I have to add chart.render() somewhere but I don't know where.  I've tried many different combinations, any help would be much appreciated.