开发者

Unable to save image in Fusion Charts v3

开发者 https://www.devze.com 2023-02-23 08:29 出处:网络
I have successfully created a 2D Pie Chart using Fusion Charts v3 API. Following is my HTML file : <html>

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' showExpo开发者_Go百科rtDataMenuItem='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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消