darcy
Members-
Content count
3 -
Joined
-
Last visited
Everything posted by darcy
-
Trouble exporting chart to PDF after changing caption attribute
darcy posted a topic in Javascript Problems
I have a project that shows graphs of various bits of information. I've been able to create PDF's of the rendered graphs but have recently been asked to show additional information only when the graph is exported as a PDF. I've chosen to populate the caption attribute of the XML to show the additional information but haven't been able to export the PDF once I've changed the XML. Here's the code I'm doing in the javascript of the page: // Get the current chart information var chartObj = getChartFromId('<%=CallGraph1.ClientID%>_FC'); var chartXML = chartObj.getXML(); // add a caption var newXML = chartXML.substr(0, chartXML.indexOf("animation") - 1); newXML = newXML.concat(captionString); // captionString is defined and created above newXML = newXML.concat(chartXML.substr(chartXML.indexOf("animation")-1)); // update the current chart information to include the new caption chartObj.setDataXML(newXML); // chartObj.render('<%=CallGraph1.ClientID%>_FCDiv'); /* note that this fails as no method is found */ // Export the chart to PDF if (chartObj.hasRendered()) /* at this point the graph is NOT in rendered state so the exportChart method is never called */ chartObj.exportChart(); My biggest issue is that once I modify the chart it's no longer "rendered" so won't export to PDF. I haven't found a way to render the chart again once I modify it. Any suggestions? -
Trouble exporting chart to PDF after changing caption attribute
darcy replied to darcy's topic in Javascript Problems
Thanks Shamasis, the delay was what I was missing. -
Trouble exporting chart to PDF after changing caption attribute
darcy replied to darcy's topic in Javascript Problems
Thanks for the response! The part that fails is here: if (chartObj.hasRendered()) chartObj.exportChart(); The call to hasRendered() returns false so the next line (exportChart) never gets called. As for the chart attributes, I'm first pulling the XML from the graph then adding a caption. Here's the XML before and after I've added my caption property (note that the data has been removed from this post). Before: <chart showFCMenuItem="0" animation="1" showLabels="1" rotateLabels="0" showYAxisValues="1" formatNumberScale="0" decimals="2" exportShowMenuItem="1" exportEnabled="1" exportAtClient="0" exportHandler="/Exporting/FCExporter.aspx" exportDialogMessage="Preparing graph:" exportFormats="PDF=Export as PDF" exportAction="download" exportFileName="Log" bgAlpha="0" showLegend="1" legendPosition="RIGHT" showBorder="1" defaultAnimation="1" showValues="0"> After: <chart showFCMenuItem="0" caption="Date Range: 5/25/2010 to 5/26/2010" animation="1" showLabels="1" rotateLabels="0" showYAxisValues="1" formatNumberScale="0" decimals="2" exportShowMenuItem="1" exportEnabled="1" exportAtClient="0" exportHandler="/Exporting/FCExporter.aspx" exportDialogMessage="Preparing graph:" exportFormats="PDF=Export as PDF" exportAction="download" exportFileName="Log" bgAlpha="0" showLegend="1" legendPosition="RIGHT" showBorder="1" defaultAnimation="1" showValues="0"> The two appear the same except for the addition of the Date Range caption property. So it looks like modifying the chart means I need to render it again? Any suggestions on how I do that? Thanks again for any help you can offer.