fusion_freak_ Report post Posted August 6, 2012 I tried batch export in fusion charts it is not working as expected,by luck, one among the many charts in a page is captured and available for download.not all of 'em.below is the code which i have used .aspx page i have this code <asp:Content ID="Content1" ContentPlaceHolderID="HdrContentPlaceholderBody" runat="server"> <script type="text/javascript"> var totalCharts = 3; var exportComponent = new FusionChartsExportObject('exportComponentSwf', '../JQuery/FCExporter.swf'); FusionChartsExportObject.defaultParameters.debugMode = true; // set component attributes exportComponent.componentAttributes.width = '220'; exportComponent.componentAttributes.height = '200'; exportComponent.componentAttributes.saveAllTitle = ' '; exportComponent.componentAttributes.btnSaveAllTitle = 'Save all charts as single file'; exportComponent.componentAttributes.fullMode = '1'; exportComponent.componentAttributes.saveMode = 'both'; exportComponent.componentAttributes.defaultExportFilename = 'Sales Report of 1996'; // The 'exportChart()' command should not be called when the chart is yet to be rendered. // Hence, to be on the safer side, we are making sure that the export chatry option is not // called unless charts has been rendered poroperly var renderStateCounter = 0; function FC_Rendered(chartId) { renderStateCounter++; if (renderStateCounter == totalCharts) { changeBtnDisabledTo(false); } } // this event is used to track when the capturing of the chart is completed var exportStateCounter = 0; function FC_ExportReady(arg) { exportStateCounter++; if (exportStateCounter >= exportComponent.sourceCharts.length) { changeBtnDisabledTo(false); } } function exportCharts(strType) { exportComponent.sourceCharts = new Array(); for (var i = 0; i < totalCharts; i++) { exportComponent.sourceCharts.push(FusionCharts('changeorder'+i)); } if (exportComponent.sourceCharts.length < 1) { alert('Select at least one chart to export.'); return; } // set the type of export as per button parameter exportComponent.componentAttributes.defaultExportFormat = strType; exportComponent.exportAttributes.exportFormat = strType; exportComponent.Render('componentContainer'); exportStateCounter = 0; // reset counter changeBtnDisabledTo(true); //showMessage('Please wait while the charts export...'); exportComponent.BeginExport(); } // change button disabled state function changeBtnDisabledTo(btnState) { document.getElementById('exportButtonPDF').disabled = btnState; } </script> <td> <asp:Label ID="LblChangeOrder" runat="server" Text=""></asp:Label> </td> <div id="componentContainer"> </div> <input type="button" class="button" value="Export as PDF" onclick="exportCharts('PDF')" id="exportButtonPDF" /> </asp:Content> in aspx.cs file private void DrawChangeOrderGraph() { try { ds = new DataSet(); StringBuilder xmlData = new StringBuilder(); ds = //get the ds from database if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { string strfileName = DateTime.Now.ToString("ssmmhh") + "BarmyFile.xml"; xmlData.Append("<?xml version='1.0' encoding='utf-8'?>"); xmlData.Append("<chart showLegend='1' bgColor='EEECE3' caption='Change Order' xAxisName='Months' yAxisName='Hours'"); xmlData.Append(" palette='2' labelDisplay='Rotate' slantLabels='1' animation='1' formatNumberScale='0' showBorder='0'"); xmlData.Append(" exportAtClient='1' exportEnabled='1' exportHandler='exportComponentSwf' exportFileName='Changeorder'>"); for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { string strLabel = ds.Tables[0].Rows[1].ToString(); xmlData.Append("<set label='" + strLabel + "' value='" + ds.Tables[0].Rows[0] + "'/>"); xmlData.Append(System.Environment.NewLine); } xmlData.Append("</chart>"); LblChangeOrder.Text = FusionCharts.RenderChart("../JQuery/Column3D.swf", "", " xmldata.tostring()", "changeorder0", "930", "400", false, true); } else LblChangeOrder.Text = "No Data For Change Order"; } } catch (Exception ex) { Response.Write(ex.Message); } } and i have made sure that i have given same export handler name which i have given in aspx page.am i doing anything wrong. Share this post Link to post Share on other sites
fusion_freak_ Report post Posted August 6, 2012 Thanks i got it working.. Share this post Link to post Share on other sites
Guest Sumedh Report post Posted August 6, 2012 Its glad to know, that you have managed to resolve your issue. Share this post Link to post Share on other sites