Sign in to follow this  
JezLisle

Saving As Image

Recommended Posts

Morning, I am new to both Fusion Charts & PHP. I have a chart that populates from a database source which works great. I am now looking at how to save a chart as an image.

 

After following the online documentation it still doesn't give me the option to do this. Is there an alternate way I can do this?

 

Jez

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

Welcome to FusionCharts Forum! smile.gif

Starting FusionCharts v3.0.7, you could export your charts as images. And FusionCharts v3.1 adds new dimensions to it, by allowing you to export as PDFs as well, and also lets you choose whether to export the charts at client-side or server-side.

For more details, please visit the "Exporting as Image/PDF" section of FusionCharts online documentation. (http://www.fusioncharts.com/docs)

Hope this helps.

Share this post


Link to post
Share on other sites

Hi,

Welcome to FusionCharts Forum! smile.gif

Starting FusionCharts v3.0.7, you could export your charts as images. And FusionCharts v3.1 adds new dimensions to it, by allowing you to export as PDFs as well, and also lets you choose whether to export the charts at client-side or server-side.

For more details, please visit the "Exporting as Image/PDF" section of FusionCharts online documentation. (http://www.fusioncharts.com/docs)

Hope this helps.

 

I have used these online docs, and still having issues being able to save.

 

<?php

 

$sql = $strsql;

 

$rs=odbc_exec($cnn,$sql);

 

if (!$rs)

 

{exit("Error in SQL");}

 

$i = 0;

 

while (odbc_fetch_row($rs))

 

{

 

$monthname =odbc_result($rs,"MonthName");

 

$referral =odbc_result($rs,"Referrals");

 

$discharge =odbc_result($rs,"Discharges");

 

$arrData[$i++][1] = $monthname;

 

$arrData[$i++][2] = $referral;

 

$arrData[$i++][3] = $discharge;

 

}

 

//Initialize <chart> element

 

$strXML = "<chart caption='Referrals Against Discharges' showExportDataMenuItem='1' exportEnabled='1' exportHandler='class/exporter' exportAtClient='0' exportAction='download' exportTargetWindow='_blank' exportFileName='MyFileName' xAxisName='Months' yAxisName='Counts' numberPrefix='' formatNumberScale='1' rotateValues='1' placeValuesInside='1' decimals='0' >";

 

//Initialize <categories> element - necessary to generate a multi-series chart

 

$strCategories = "<categories>";

 

//Initiate <dataset> elements

 

$strDataCurr = "<dataset seriesName='Referrals'>";

 

$strDataPrev = "<dataset seriesName='Discharges'>";

 

//Iterate through the data

 

foreach ($arrData as $arSubData)

 

{

 

//Append <category name='...' /> to strCategories

 

$strCategories .= "<category name='" . $arSubData[1] . "' />";

 

//Add <set value='...' /> to both the datasets

 

$strDataCurr .= "<set value='" . $arSubData[2] . "' />";

 

$strDataPrev .= "<set value='" . $arSubData[3] . "' />";

 

}

 

//Close <categories> element

 

$strCategories .= "</categories>";

 

//Close <dataset> elements

 

$strDataCurr .= "</dataset>";

 

$strDataPrev .= "</dataset>";

 

 

 

//Assemble the entire XML now

 

$strXML .= $strCategories . $strDataCurr . $strDataPrev . "</chart>";

 

?>

 

 

 

<?php

 

//Create the chart - MS Column 3D Chart with data contained in strXML

 

echo renderChart("charts/MSColumn3D.swf", "", $strXML, "ReferralsAgainstDischarges", 600, 300, false, false);

 

?>

 

Edited by JezLisle

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

The sample code for saving the chart as image can be available from: FusionCharts_Evaluation- Code- PHP-Export in FusionCharts download package.

 

Hope this helps.

Share this post


Link to post
Share on other sites

That is where I got all the code from to do the Export as image, after reading the Online docs.

 

My problem as mentioned before is that I have followed what has been done in the sample code and the online docs and still I dont get my own code to do what the sample does. This is why I have posted to see where I have gone wrong?

 

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Please make sure you have provided the correct path and name of server side export handler in your PHP file .

 

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

 

Could you please confirm the FusionCharts version you are using?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for your response.

 

Could you please confirm the FusionCharts version you are using?

 

Awaiting for your response.

 

I am using the Free version from the website

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