Sign in to follow this  
ryadaval

Purejavascriptchart Save To Serverside

Recommended Posts

Hi,

 

I am using fusionchart v3.2 to generate chart with javascript method, after generating image I would like to export into serverside, for this I also changed related paths in FCExporter.php and given below parameters to <chart> tag :

exportEnabled='1' exportAtClient='0' exportAction='save' exportHandler='http://localhost/testinstance/FusionCharts_User/ExportHandlers/PHP/FCExporter.php' exportFileName='MyFileName'

 

it is rendering image in the browser , but if click on export chart button chart suppose to save in specified disk folder, but directly downloading at client place instead of saving to serverside .

 

please give me any suggestion to resolve this issue using javascript method.

 

Thanks,

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

 

Could you please send us the sample code and the generated XML codes for the same?

 

Awaiting your reply.

Share this post


Link to post
Share on other sites

Hi,

 

Could you please send us the sample code and the generated XML codes for the same?

 

Awaiting your reply.

 

My code is below :

 

<script type="text/javascript">

function startExport(){

//Get reference to chart.

var chart = getChartFromId("myChartId");

//Now, we proceed with exporting only if chart has finished rendering.

if (chart.hasRendered()==true){

chart.exportChart({exportFormat:'jpg'});

}else{

alert("Please wait for the chart to finish rendering, before you can invoke exporting");

}

}

 

// -->

</script>

my XML code is :

 

<chart caption='Weekly Sales Summary' xAxisName='Week' yAxisName='Sales' numberPrefix='$'

exportEnabled='1' exportShowMenuItem="0" exportAtClient='0' exportAction='save' exportHandler='http://localhost/test/FusionCharts_User/ExportHandlers/PHP/FCExporter.php' exportFileName='test' exportCallback='myCallBackFunction'>

<set label='Week 1' value='14400' />

<set label='Week 2' value='19600' />

<set label='Week 3' value='24000' />

<set label='Week 4' value='15700' />

</chart>

 

my Html code :

<html>

<button onclick="startExport();">Export</button>

<head>

<title>My First chart using FusionCharts - Using pure JavaScript</title>

<script type="text/javascript" src="http://localhost/test/FusionCharts_User/Charts/FusionCharts.js"></script>

 

</head>

<body>

<div id="chartContainer">FusionCharts will load here!</div>

<script type="text/javascript"><!--

 

FusionCharts.setCurrentRenderer('javascript');

 

var myChart = new FusionCharts( "http://localhost/test/FusionCharts_User/Charts/Column2D.swf",

"myChartId", "400", "300", "0", "1" );

myChart.setXMLUrl("http://localhost/test/FusionCharts_User/Code/ExportChartSamples/PureJavaScript/Data.xml");

myChart.render("chartContainer");

 

// -->

</script>

</body>

</html>

 

Thanks,

Edited by ryadaval

Share this post


Link to post
Share on other sites

My code is below :

 

<script type="text/javascript">

function startExport(){

//Get reference to chart.

var chart = getChartFromId("myChartId");

//Now, we proceed with exporting only if chart has finished rendering.

if (chart.hasRendered()==true){

chart.exportChart({exportFormat:'jpg'});

}else{

alert("Please wait for the chart to finish rendering, before you can invoke exporting");

}

}

 

// -->

</script>

my XML code is :

 

<chart caption='Weekly Sales Summary' xAxisName='Week' yAxisName='Sales' numberPrefix='$'

exportEnabled='1' exportShowMenuItem="0" exportAtClient='0' exportAction='save' exportHandler='http://localhost/test/FusionCharts_User/ExportHandlers/PHP/FCExporter.php' exportFileName='test' exportCallback='myCallBackFunction'>

<set label='Week 1' value='14400' />

<set label='Week 2' value='19600' />

<set label='Week 3' value='24000' />

<set label='Week 4' value='15700' />

</chart>

 

my Html code :

<html>

<button onclick="startExport();">Export</button>

<head>

<title>My First chart using FusionCharts - Using pure JavaScript</title>

<script type="text/javascript" src="http://localhost/test/FusionCharts_User/Charts/FusionCharts.js"></script>

 

</head>

<body>

<div id="chartContainer">FusionCharts will load here!</div>

<script type="text/javascript"><!--

 

FusionCharts.setCurrentRenderer('javascript');

 

var myChart = new FusionCharts( "http://localhost/test/FusionCharts_User/Charts/Column2D.swf",

"myChartId", "400", "300", "0", "1" );

myChart.setXMLUrl("http://localhost/test/FusionCharts_User/Code/ExportChartSamples/PureJavaScript/Data.xml");

myChart.render("chartContainer");

 

// -->

</script>

</body>

</html>

 

Thanks,

 

waiting for your feedback

 

Thanks,

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