Sign in to follow this  
Cory

Exporting images javascript

Recommended Posts

<?php
include("../Includes/FusionCharts.php");
//include("../../../ExportHandlers/PHP/FCExporter.php");
?>
<html>
<head>
    <title>
    FusionCharts - Array Example using Single Series Column 3D Chart
    </title>    
<script type="text/Javascript" SRC="../../../Charts/FusionCharts.js"></script>
<script type="text/javascript" LANGUAGE="Javascript" SRC="../../../Charts/jquery.min.js"></script>
<style type= "text/css" >
.div1 {
height:360px;
width:650px;
background:#FFF0FF;
background-repeat:no-repeat;
border:2px solid #995699;
}
.div2 {
height:35px;
width:105px;
background:#FFF0FF;
background-repeat:no-repeat;

}
</style>
    <script type="text/Javascript" >
        function callPrint(){

            window.print();
        }
        function callExport(val){

           var chartObject = FusionCharts('myChart');
         if( chartObject.hasRendered() )
         {
             if(val==1){
         chartObject.exportChart({ exportAtClient:'1',exportFormat:'PNG'});

             }
             else{

            chartObject.exportChart({ exportAtClient:'1',exportFormat:'PDF'});


                 }
         }

        }


    </script>
</head>
<body>
<center>
<h2>Ejemplo Export</h2>
<h4></h4>
<div class="div1">

    <div class="div2" align="right">
      <p align="right"><a  href='#' onClick="callExport(1)"><img width='32' height='32' title='Share' src='1.PNG' border='0'></a>     
       <a  href='#' onclick='callPrint();'><img width='30' height='30' title='Print' src='2.png' border='0'></a></p>
    </div>
<?php


    //Now, we need to convert this data into XML. We convert using string concatenation.
    //Initialize <chart> element
    $strXML = "<chart caption='Exam result for CSC113A ' numberPrefix='' formatNumberScale='10' xAxisName='Grades' yAxisName='No Of Students' bgColor='FFFFCC,FFFFCC' exportEnabled='1'  exportAtClient='0' exportAction='download'  exportShowMenuItem='0' exportFormats='JPG=Download as JPEG|PDF=Download as SVG'>";
    //Convert data to XML and append

    $strXML .= "<set label='L' value='10'/></chart>";//Comment this line of code to render the data from your database. This line of code is only for testing purpose


    //Un-comment the below line of code to render the chart in pure JavaScript forcefully.
    FC_SetRenderer('javascript');

    //Create the chart - Column 3D Chart with data contained in strXML
    echo renderChart("../../../Charts/Column3D.swf", "", $strXML, "myChart", 600, 300, false, true);

?>
</div>
</center>
</body>
</html>

Hello,

I am trying to export images, the code works fine in windows rendering javascript only, though when I try it on my iphone it does nothing.

 

Share this post


Link to post
Share on other sites
<?php
include("../Includes/FusionCharts.php");
//include("../../../ExportHandlers/PHP/FCExporter.php");
?>
<html>
<head>
    <title>
    FusionCharts - Array Example using Single Series Column 3D Chart
    </title>    
<script type="text/Javascript" SRC="../../../Charts/FusionCharts.js"></script>
<script type="text/javascript" LANGUAGE="Javascript" SRC="../../../Charts/jquery.min.js"></script>
<style type= "text/css" >
.div1 {
height:360px;
width:650px;
background:#FFF0FF;
background-repeat:no-repeat;
border:2px solid #995699;
}
.div2 {
height:35px;
width:105px;
background:#FFF0FF;
background-repeat:no-repeat;

}
</style>
    <script type="text/Javascript" >
        function callPrint(){

            window.print();
        }
        function callExport(val){

           var chartObject = FusionCharts('myChart');
         if( chartObject.hasRendered() )
         {
             if(val==1){
         chartObject.exportChart({ exportAtClient:'1',exportFormat:'PNG'});

             }
             else{

            chartObject.exportChart({ exportAtClient:'1',exportFormat:'PDF'});


                 }
         }

        }


    </script>
</head>
<body>
<center>
<h2>Ejemplo Export</h2>
<h4></h4>
<div class="div1">

    <div class="div2" align="right">
      <p align="right"><a  href='#' onClick="callExport(1)"><img width='32' height='32' title='Share' src='1.PNG' border='0'></a>     
       <a  href='#' onclick='callPrint();'><img width='30' height='30' title='Print' src='2.png' border='0'></a></p>
    </div>
<?php


    //Now, we need to convert this data into XML. We convert using string concatenation.
    //Initialize <chart> element
    $strXML = "<chart caption='Exam result for CSC113A ' numberPrefix='' formatNumberScale='10' xAxisName='Grades' yAxisName='No Of Students' bgColor='FFFFCC,FFFFCC' exportEnabled='1'  exportAtClient='0' exportAction='download'  exportShowMenuItem='0' exportFormats='JPG=Download as JPEG|PDF=Download as SVG'>";
    //Convert data to XML and append

    $strXML .= "<set label='L' value='10'/></chart>";//Comment this line of code to render the data from your database. This line of code is only for testing purpose


    //Un-comment the below line of code to render the chart in pure JavaScript forcefully.
    FC_SetRenderer('javascript');

    //Create the chart - Column 3D Chart with data contained in strXML
    echo renderChart("../../../Charts/Column3D.swf", "", $strXML, "myChart", 600, 300, false, true);

?>
</div>
</center>
</body>
</html>

Hello,

I am trying to export images, the code works fine in windows rendering javascript only, though when I try it on my iphone it does nothing.

 

Hi,

 

Could you please let us know the issue you are facing while exporting on iPhone? You may try exporting the following sample and see if this works as expected.

Ref.- http://www.fusioncharts.com/explore/export-charts-as-images-and-PDF/

 

Also, in case you are using an older version, could you please upgrade your current version to the latest, i.e, FusionCharts v3.4 that includes a lot of new features and enhancements?

 
To download the Evaluation version of FusionCharts Suite XT v3.4, please visit the link: http://www.fusioncharts.com/download/
 
You can see the upcoming new docs at http://docs.fusioncharts.com and new additions at http://docs.fusioncharts.com/tutorial-setup-whats-new.html.
 
Hope this helps. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this