Powderworks Report post Posted September 3, 2008 Having trouble getting two charts to display on the one page Here is the code You can see I have duplicated the GetFactorySummaryChartHtml() The first one displays but the second doesn't display public string GetFactorySummaryChartHtml(){ //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we've used an Access database which is present in //../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each //other. //xmlData will be used to store the entire XML document generated StringBuilder xmlData=new StringBuilder(); //Generate the chart elementxmlData.Append( "<chart caption='Recommendation Progress Report' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=''>"); //Create recordset to get details for the factories //string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ; string factoryQuery = " SELECT complete, Count(*) as TotQ FROM recommendations GROUP BY Complete"; DbConn oRs = new DbConn(factoryQuery); //Iterate through each record while (oRs.ReadData.Read()){ //Generate <set name='..' value='..' /> String lablecompleted = " "; if (oRs.ReadData["Complete"].ToString() == "Yes"){ lablecompleted = "Completed";} if (oRs.ReadData["Complete"].ToString() == "No"){ lablecompleted = " Not Completed";} xmlData.AppendFormat( "<set label='{0}' value='{1}' />", lablecompleted , oRs.ReadData["TotQ"].ToString()); //xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());} oRs.ReadData.Close(); //Close chart elementxmlData.Append( "</chart>"); //Create the chart - Pie 3D Chart with data from xmlData return FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "", xmlData.ToString(), "FactorySum", "400", "200", false, false);} public string GetFactorySummaryChartHtml2(){ //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we've used an Access database which is present in //../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each //other. //xmlData will be used to store the entire XML document generated StringBuilder xmlData = new StringBuilder(); //Generate the chart elementxmlData.Append( "<chart caption='Recommendation Progress Report' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=''>"); //Create recordset to get details for the factories //string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ; string factoryQuery = " SELECT complete, Count(*) as TotQ FROM recommendations GROUP BY Complete"; DbConn oRs = new DbConn(factoryQuery); //Iterate through each record while (oRs.ReadData.Read()){ //Generate <set name='..' value='..' /> String lablecompleted = " "; if (oRs.ReadData["Complete"].ToString() == "Yes"){ lablecompleted = "Completed";} if (oRs.ReadData["Complete"].ToString() == "No"){ lablecompleted = " Not Completed";} xmlData.AppendFormat( "<set label='{0}' value='{1}' />", lablecompleted, oRs.ReadData["TotQ"].ToString()); //xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());} oRs.ReadData.Close(); //Close chart elementxmlData.Append( "</chart>"); //Create the chart - Pie 3D Chart with data from xmlData return FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "", xmlData.ToString(), "FactorySum", "400", "200", false, false);} Share this post Link to post Share on other sites
Arindam Report post Posted September 4, 2008 Hi, Could you please give different chart ID name and also set swf cache is off. Please see this code // 1st render chart from GetFactorySummaryChartHtml() return FusionCharts.RenderChart("../FusionCharts/Column3D.swf?noCache=1", "", xmlData.ToString(), "FactorySum1", "400", "200", false, false); // 2nd render chart from GetFactorySummaryChartHtml2() return FusionCharts.RenderChart("../FusionCharts/Column3D.swf?noCache=2", "", xmlData.ToString(), "FactorySum2", "400", "200", false, false); Share this post Link to post Share on other sites
Powderworks Report post Posted September 4, 2008 Thanks for the prompt response I will give that a go Share this post Link to post Share on other sites