aman0711 Report post Posted June 29, 2009 (edited) Hi Experts, I just got the V3.1 version and Want my charts to have save as image and save as pdf functionality. In your last version, I used to have your FusionChartsSave.jsp then two tags in the Chart tag(imageSaveURL and imageSave), which always did the trick. I tried using the same on my code this time and once the the data capturing part got to 100%, a white blank page was returned.. am I missing something? I saw some posts regarding this functionality in 3.1 which I already have. Can you please describe in detail how to use it in my application. I didnt get this peace of code below: FusionCharts Export Handler Component I never saw this line before either. var myExportComponent = new FusionChartsExportObject("fcExporter1", "../../FusionCharts/FCExporter.swf"); I am using the createChart method to render the chart. I would highly appreciate if you can tell me the instructions to implement these feature from grass root level. BELOW is the code we are using to generate our charts currently: <% Connection conn = null; Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@","user","pass"); %> <%-- Fusion Chart XML creation using dataXML method --%> <% String strXml=""; String strQuery1="", strQuery2="", strQuery3="", strQuery4="", cat="", dataset1="", dataset2="", dataset3="", dataset4=""; strXml=""; try{ Statement st1, st2, st3, st4; ResultSet rs1, rs2, rs3, rs4; strQuery1= "Select * from VSLAND.APM_WEB_12MONTH_APPGRP_V WHERE APP_GROUP='EBILL' ORDER BY DECODE(UPPER(MONTH), 'JAN', 7, 'FEB', 8, 'MAR', 9, 'APR', 10, 'MAY', 11, 'JUN', 12, 'JUL', 1, 'AUG', 2, 'SEP', 3, 'OCT', 4, 'NOV', 5, 'DEC', 6)"; strQuery2= "Select * from VSLAND.APM_WEB_12MONTH_APPGRP_V WHERE APP_GROUP='EDD' ORDER BY DECODE(UPPER(MONTH), 'JAN', 7, 'FEB', 8, 'MAR', 9, 'APR', 10, 'MAY', 11, 'JUN', 12, 'JUL', 1, 'AUG', 2, 'SEP', 3, 'OCT', 4, 'NOV', 5, 'DEC', 6)"; strQuery3= "Select * from VSLAND.APM_WEB_12MONTH_APPGRP_V WHERE APP_GROUP='KANAC' ORDER BY DECODE(UPPER(MONTH), 'JAN', 7, 'FEB', 8, 'MAR', 9, 'APR', 10, 'MAY', 11, 'JUN', 12, 'JUL', 1, 'AUG', 2, 'SEP', 3, 'OCT', 4, 'NOV', 5, 'DEC', 6)"; strQuery4= "Select * from VSLAND.APM_WEB_12MONTH_APPGRP_V WHERE APP_GROUP='QuickPay' ORDER BY DECODE(UPPER(MONTH), 'JAN', 7, 'FEB', 8, 'MAR', 9, 'APR', 10, 'MAY', 11, 'JUN', 12, 'JUL', 1, 'AUG', 2, 'SEP', 3, 'OCT', 4, 'NOV', 5, 'DEC', 6)"; st1=conn.createStatement(); rs1=st1.executeQuery(strQuery1); while(rs1.next()){ cat += ""; dataset1 +=""; } rs1.close(); st1.close(); st2=conn.createStatement(); rs2=st2.executeQuery(strQuery2); while(rs2.next()){ // cat += "" ; dataset2 +=""; } rs2.close(); st2.close(); st3=conn.createStatement(); rs3=st3.executeQuery(strQuery3); while(rs3.next()){ // cat += "" ; dataset3 +=""; } rs3.close(); st3.close(); st4=conn.createStatement(); rs4=st4.executeQuery(strQuery4); while(rs4.next()){ // cat += "" ; dataset4 +=""; } rs4.close(); st4.close(); }catch (Exception e){} strXml += " "+cat+""; strXml += " "+dataset1+" "; strXml += " "+dataset2+" "; strXml += " "+dataset3+" "; strXml += " "+dataset4+" "; strXml += ""; out.print(strXml); String chartCode=createChart("../FusionCharts/MSLine.swf", "", strXml, "SLA", 745, 300, false, false); %> <% conn.close(); %> <%=chartCode%> Please tell me the reason why currently I am only using a white screen after the data capture process is done. Edited June 29, 2009 by Guest Share this post Link to post Share on other sites
Rahul Kumar Report post Posted June 30, 2009 (edited) Hi, We have implemented a new image saving mechanism by which you can export chart to image or PDF either at client side at server side. And the following code renders the "FusionCharts Export Handler Component", which is necessary when you are using client side exporting: <!-- We also create a DIV to contain the FusionCharts client-side exporter component --> <div id="ffffffcexpDiv" align="center">FusionCharts Export Handler Component</div> <script type="text/javascript"> //Render the export component in this //Note: fcExporter1 is the DOM ID of the DIV and should be specified as value of exportHandler //attribute of chart XML. var myExportComponent = new FusionChartsExportObject("fcExporter1", "../../FusionCharts/FCExporter.swf"); //Render the exporter SWF in our DIV fcexpDiv myExportComponent.Render("fcexpDiv"); </script> Also please refer to http://www.fusioncharts.com/docs/ >> Exporting as Image/PDF section to get more detail information on the same. Edited June 30, 2009 by Guest Share this post Link to post Share on other sites
aman0711 Report post Posted June 30, 2009 Hi Rahul, Few things I am real confused about: 1. Where do I need to declare this new code you told me about in your last post. 2. do I need to get Version 3.1 swf files for all the charts or even the older version ones will work? 3. Is there any special jars I need to put in my application. I am running Tomcat 6 on jdk 1.5 Your reply is highly appreciated and urgently needed Regards Aman Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 1, 2009 Hi Aman, The "single-jsp save as image" method, from the earlier versions, was simple but not comprehensive. With the newer mechanism of server side and client side export, you can save the chart as png, jpg, gif or pdf too. Let me try to summarize the steps in getting the jsp server-side export feature up and running: Copy the following files to your server: Copy the jsps to your web application ( say root folder ) 1. FCExporter.jsp 2. FCExporterError.jsp 3. Resources/FCExporter_IMG.jsp ( copy the Resources folder also ) 4. Resources/FCExporter_PDF.jsp( copy the Resources folder also ) Copy the jar file to WEB-INF/lib folder 5. fcexporter.jar (contains all the dependency classes) Copy the properties file to WEB-INF/classes folder 6. /Classes/fusioncharts_export.properties (configuration files) Add XML Attributes related to Export Feature:exportEnabled='1' exportHandler='FCExporter.jsp' exportAtClient='0' exportAction='download' exportFileName='MyFileName' You can get the complete list of attributes and how to use the server side export feature in these doc pages, http://www.fusioncharts.com/docs/Contents/ECServerDownload.html http://www.fusioncharts.com/docs/Contents/ECServerSave.html Modify properties file if requiredFor example, you might want to change the path on the server where the images will be saved. The property for this SAVEPATH is shown below. #Please specify the path to a folder (with write permissions) relative to web application root #The exported image/PDF files would be saved here. SAVEPATH=./images/ Please do not hesitate to contact me in case you get stuck in any of these steps. Hope this helps Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 1, 2009 Hey Srividya, Thanks for such a detailed reply :-) Really very helpful, but still stuck with some problem ok, so I followed all your steps, but when I right click on the chart, I am not seeing any option such as save as pdf or save as image. I have attached the snapshot of my folder structure, Generated chart XML, the backend code that generates the chart XML. PS: All the my static content is accessed with following path: I am very sure, this problem is related to path issues.. have attached all the details.. please help me out, more like an urgent problem Thanks in advance Srividya Regards Aman MSColumn2DXmlBuilder.txt chart XML.txt Share this post Link to post Share on other sites
aman0711 Report post Posted July 1, 2009 If you are wondering whether Resources folder contains the correct files then I have to say YES Resources folder has: FCExporter_IMG.jsp FCExporter_PDF.jsp Just forgot to expand this folder in snapshot Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Hi Aman, I have checked your xml and the folder structure. They seem to be fine. I have tested the xml and it works fine- Save as jpeg etc are shown in the context menu. If you are not getting the export related menu items, then I doubt the version of the swf file is below 3.1 Please verify the version of the swf file ( MSColumn2D.swf ) To see the version of the swf file, turn the debug mode on. In the debug mode, the version of the file is displayed. Hope this helps. Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 Hi Srividya, Little improvement. I did change the swf files and now I can see the options to save. I am not able to see any image or pdf after the data capturing is done. All I am getting is a blank page with the following URL: http://localhost:8080/analytics/static/Fusion/FusionCharts/FCExporter.jsp which means it is even getting to the FCExporter.jsp, What problem is it facing to render the image or pdf? Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Hi Aman, Shouldn't the path to the FCExporter.jsp be http://localhost:8080/analytics/static/Fusion/FCExporter.jsp as per your folder structure? Note the omitted FusionCharts in the path. Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 I changed the structure Srividya, Attached is the snap. replaced it with localhost... but I can still only see a blank : FCExporter.jsp Do you think this code is creating trouble? StringBuffer err_warn_Codes = [b]new[/b] StringBuffer(); String WEB_ROOT_PATH = application.getRealPath("/"); String pathSeparator = File.separator; // will return either "" or "/", depends on OS String validation_def_filepath = WEB_ROOT_PATH+pathSeparator+FusionChartsExportHelper.RESOURCEPATH+"validation_def.jsp"; String relativePathToValidationDef = FusionChartsExportHelper.RESOURCEPATH+"validation_def.jsp"; Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 Forgot to attach snapshot Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Hi Aman, There is no problem in the export code - That part of the code is not used currently - will not cause any issues. I think the problem is with the properties file. Can you please attach your fusioncharts_export.properties file? Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 I hope this properties file will fix the Issue Srividya and Yes I ahvent edited anything in the properties file. Could you please edit it for me? I am quite a novice with it. properties.txt Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 So I changed the RESOURCEPATH of my properties file to: RESOURCEPATH=/analytics/static/Fusion/FusionCharts/Resources/ but still the same result Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Hi Aman, Please verify FusionCharts folder is within WEBAPP-ROOT> analytics > static > Fusion. Try giving relative path to the exporter jsp. If your chart jsp is in root folder, then exportHandler= './analytics/static/Fusion/FusionCharts/FCExporter.jsp' would work. Also, have you configured the logger? If so, we could see some log messages too, for further debugging. Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 Hey Srividya, Sorry for bugging you so much... its so frustrating, I am so close yet so far Did the change you mentioned, and still the same blank output. Below is my resources file: I tried it with localhost and "." #This constant defines the name of the export handler jsp file - DO NOT MODIFY THIS!!! EXPORTHANDLER=FCExporter_ #Path where the export handler files are located #Please note that the resource path should be relative to #FCExporter.jsp file's directory #By default the path is "Resources/" RESOURCEPATH=./analytics/static/Fusion/FusionCharts/Resources/ #Please specify the path to a folder with write permissions relative to web application root #The exported image/PDF files would be saved here. SAVEPATH=./images/ #This constant HTTP_URI stores the HTTP reference to #the folder where exported charts will be saved. #Please enter the HTTP representation of that folder #in this constant e.g., http://www.yourdomain.com/images/ HTTP_URI=http://www.yourdomain.com/images/ #OVERWRITEFILE sets whether the export handler would overwrite an existing file #the newly created exported file. If it is set to false the export handler would #not overwrite. In this case if INTELLIGENTFILENAMING is set to true the handler #would add a suffix to the new file name. The suffix is a randomly generated UUID. #Additionally, you can add a timestamp or random number as additional prefix. OVERWRITEFILE=false INTELLIGENTFILENAMING=true FILESUFFIXFORMAT=TIMESTAMP Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Hi Aman, Can you just share the complete deployable? ( relevant to FusionCharts ). I will test it here Instead of the XML Builder java, I would use static xml file here. Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 2, 2009 I already uploaded the webapp in one of my post, Strange I cant see my own post now. Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 2, 2009 Please post it again. Share this post Link to post Share on other sites
aman0711 Report post Posted July 3, 2009 (edited) Hi Srividya, I cant attach any other file now, because its complaining about the attachment size exceeded. Can I have your email address so that I can forward you the webapp folder. You can email me at [email protected] and I can reply back to that :-) if thats not an issue. Edited September 3, 2009 by Guest Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 12, 2009 (edited) Ok, after taking a look at the webapp, I made some changes and sent it back. Just for the benefit of all, I thought I should post the solution to the problem. 1. The path to the FusionCharts.js in the html containing the chart should be correct. ( This can cause the "FusionCharts undefined" javascript error. The chart itself will not be visible in this case ) 2. The swf files should be latest. ( If the swf files are not latest ( version >=3.1 ) then export-related context menu items "Save As JPEG" etc will not be available. ) 3. The path to the FCExporter.jsp in exportHandler XML attribute should be correct. ( If this path is incorrect, you would get a "Page not found" in Internet Browser. ) 4. The path to the Resources folder in the .properties file should be correct. ( If this path is incorrect, you would see a blank page after capturing data is 100% complete ) Correcting all the above problems in the webapp solved the user's issue. Srividya Edited July 12, 2009 by Guest Share this post Link to post Share on other sites
aman0711 Report post Posted July 13, 2009 Hi Srividya, Now it doesnt een work on FireFox... i have no clue.. what is going on After Data Capture, I am getting FCexporter.jsp (the complete code of FCexporter.jsp in the browser body) Share this post Link to post Share on other sites
ravikapa Report post Posted July 21, 2009 Hi This is Ravi i also configured like above as same in prevoius posts. in my browser it's displaying with the options like save as JPEG,save as PNG,save as PDF if i select any of the action among those.it's showing process bar that 100% complete up to here working fine but the problem is i have the export path in "fusioncharts_export.properties" as ./images folder but after 100% completion the page is re-directing to ../jsp/FCExporter.jsp page with blank data pls help me regarding this... iam using fusion charts free evaluvation version and java 1.6 Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 21, 2009 Hi Please upload the webapp. Or if you have a live site, please provide the link. I can take a look at it. Srividya Share this post Link to post Share on other sites
aman0711 Report post Posted July 21, 2009 Srividya, I am facing the exact same issue Ravi is facing Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 21, 2009 (edited) Hi Aman, Ravi This should be a path issue only. There are only 3 important path values used for export. 1. RESOURCEPATH in fusioncharts_export.properties. ( relative to web application root ) 2. SAVEPATH in fusioncharts_export.properties. ( in case of server side "save" ) 3. exportHandler attribute in xml. Please check all three. I will upload a sample web app in my next post. Ravi, you can test and see if that works. Edited July 21, 2009 by Guest Share this post Link to post Share on other sites
srividya_sharma Report post Posted July 21, 2009 Hi Ravi, Here is a sample web application to test the export feature. Just place the swf and js files in FusionCharts folder. First see if this works, then we can proceed from there. Srividya FusionChartsExportApp.zip Share this post Link to post Share on other sites
oesku25 Report post Posted March 2, 2010 Hello, I'm new to fusioncharts and just finished testing your test app. The save method does NOT save in image or whatever folder you specify in the property file, but in the root folder of the application... Share this post Link to post Share on other sites
srividya_sharma Report post Posted March 2, 2010 Hi Can you tell me the path you are specifying ? Also, tell me the directory structure in which the files are present. Thanks Share this post Link to post Share on other sites
oesku25 Report post Posted March 3, 2010 Hi, Thanks for replying to my question. Find attached the structure of the files I'm trying to adapt... When I run the program no error is thrown (js alert), but a javascript error occurs.. Any suggestion would be great. Thanks. oswald Share this post Link to post Share on other sites