Unable to save image in Fusion Charts v3

吃可爱长大的小学妹 提交于 2019-12-13 07:29:03

问题


I have successfully created a 2D Pie Chart using Fusion Charts v3 API. Following is my HTML file :

<html>
  <head>        
    <title>My First chart using FusionCharts</title>    
    <script type="text/javascript" src="FusionCharts.js">
    </script>
    <script type="text/javascript" src="FusionChartsExportComponent.js">
    </script>

  </head>   
  <body>     
    <div id="chartContainer"></div>          
    <script type="text/javascript">         

      var myChart = new FusionCharts( "Pie2D.swf", 
      "myChartId", "500", "500", "0", "1" );
      myChart.setXMLUrl("age-demographics.xml");
      myChart.render("chartContainer");


    </script>     

    <div id="fcexpDiv" 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", "FCExporter.swf");
        myExportComponent.debugMode = true;
        //Render the exporter SWF in our DIV fcexpDiv      
        myExportComponent.Render("fcexpDiv");   
    </script>
  </body> 
</html>

and this is my XML file :

<chart caption='Age Demographics' showPercentValues='1' exportEnabled='1' exportAtClient='1' exportHandler='fcExporter1' showExportDataMenuItem='1'>
    <set label='3-11' value='0' />
    <set label='12-17' value='5' />
    <set label='18-25' value='99' />
    <set label='26-34' value='65' />
    <set label='35-49' value='0' />
    <set label='50+' value='5' />
</chart>

I have the following files in my folder as said in the Fusion Charts Documentation:

FCExporter.swf
FusionCharts.js
FusionChartsExportComponent.js
highcharts.js
jquery.min.js
Pie2D.swf

I am unable to export and save the image as jpeg/png/pdf. The "capture" process initiates and completes itself to 100% but I don't see any popup "save-as" window. My flash version is 10.2.x.

Please help.


回答1:


I tried out your code and it works fine for me here. The save button of the export component gets enabled after capturing is completed.

I think that the problem is with flash global settings on your machine.

From the FusionCharts documentation,

When running client-side examples, make sure that you've copied-pasted the examples (along with ../FusionCharts folder) to your server (either localhost or remote). The reason why they would not work on local files system is that Adobe Flash Player blocks Flash to JavaScript communication on local file system for security reasons, which FusionCharts uses for client-side exporting. If you need to over-ride that for a specific folder, you'll need to visit http://www.macromedia.com/support/documentation/en/flash player/help/settings_manager04.html and then in that interface add the folder containing our examples to the list of allowed folder.

Visit the flash global settings site and allow access to flash for the specific folder or for the whole drive. This should solve your problem.




回答2:


You won't see any "save as window" after the capture process is complete. Your Export Component' Save button would get enabled or the Export Component's list would get populated.



来源:https://stackoverflow.com/questions/5585096/unable-to-save-image-in-fusion-charts-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!