friction

Batch Export for Server Side

Recommended Posts

Guest Basundhara Ghosal

Hi,

Welcome to FusionCharts forum. :)

I am afraid, as of now, FusionCharts does not support the "Batch Export" functionality on server-side.

You need to call server side export for all charts individually. So, each chart gets exported to its own single individual file.

 

Share this post


Link to post
Share on other sites

Forgive me if my question seems repeating but is it possible to export multiple charts in server side to their own single individual save file with one click of the button?

Share this post


Link to post
Share on other sites

Yes that is possible.

You can export multiple charts to their individual image files with one button click.

Call a javascript function on the click of the button, which would initiate export of multiple charts.

<script type="text/javascript">
   function ExportMyCharts() {
        var chartObject1 = getChartFromId('myChart1');
        if( chartObject1.hasRendered() ) chartObject1.exportChart();
	   // export another chart
	    var chartObject2 = getChartFromId('myChart2');
        if( chartObject2.hasRendered() ) chartObject2.exportChart();
   }
</script>

Hope this helps. :)

Srividya

Share this post


Link to post
Share on other sites

Thank you for the reply. It does help a little. However, my chart Ids are dynamic and random. Can you show me how to put it into the getChartFromId? thank you

Share this post


Link to post
Share on other sites

Thank you for replying so fast. The snippets are:

 

Random rdWidget = new Random();

 

 

 

int intWidgetId = rdWidget.nextInt(1000) + 1;

 

String rwId = Integer.toString(intWidgetId);

 

 

 

...

 

 

 

[jsp:include page="../include/FusionChartsRenderer.jsp" flush="true" ]

 

[ jsp:param name="chartSWF" value="../charts/Column3D.swf" / ]

 

[ jsp:param name="strURL" value="" / ]

 

[ jsp:param name="strXML" value="<%=strXML%>" / ]

 

[ jsp:param name="chartId" value="<%=rwId%>" / ]

 

[ jsp:param name="chartWidth" value="600" /]

 

[ jsp:param name="chartHeight" value="500" / ]

 

[ jsp:param name="debugMode" value="false" / ]

 

[ jsp:param name="registerWithJS" value="true" / ]

 

[/jsp:include]

 

 

 

i would appreciate it if you would show me how to initiate export to save folder of the charts. Thank you in advance.:)

Edited by Guest

Share this post


Link to post
Share on other sites

Hi

Just after embedding all the charts as you showed in the your previous post, you can put the javascript code

<script type="text/javascript">
   function ExportMyCharts() {
        var chartObject1 = getChartFromId('<%=rwId%>');
        if( chartObject1.hasRendered() ) chartObject1.exportChart();
	   // export another chart
	    var chartObject2 = getChartFromId('<%=rwId2%>');
        if( chartObject2.hasRendered() ) chartObject2.exportChart();
   }
</script>

I hope the number of charts being shown is static.

Hope this helps.:)

Srividya

Share this post


Link to post
Share on other sites

Hello, i have tried the method before but it is not working and the number of charts being shown is dynamic. Thank you.

Edited by Guest

Share this post


Link to post
Share on other sites

Hello,

 

I am sorry that i have not replied accurately. What i meant to say is that i have problem with the number of charts image i would like to save to the server because the number of charts to be saved at one time with one click varies and not static all the time. Thank you.:)

Share this post


Link to post
Share on other sites

Forgive me if this sounds stupid..but is this what you mean??

 

 

 

script type="text/javascript"

 

function ExportMyCharts()

 

{

 

var chartObject1 = new Array();

 

var i=0;

 

for(i=1; i<=chartObject1.length; i++)

 

{

 

chartObject1 = getChartFromId('<%=rwId%>');

 

if( chartObject1.hasRendered() ) {chartObject1.exportChart({exportFormat:'PNG'});}

 

}

 

}

 

/script

Share this post


Link to post
Share on other sites

Hi

How about this?

<script type="text/javascript">
var chartIds = new Array("<%=rwId1%>","<%=rwId2%>","<%=rwId3%>"); // or you can create the array dynamically, if required.

function ExportMyCharts() 
{
var i=0;
for(i=0; i<chartIds.length; i++)
{ 
chartObject = getChartFromId(chartIds[i]<%=rwId%>);
if( chartObject.hasRendered() ) {chartObject.exportChart({exportFormat:'PNG'});} 
}
} 
</script >

In the above code, I just stored the chartIds in an array.

Srividya :)

Edited by Guest

Share this post


Link to post
Share on other sites

Hi

I am sorry that I left you confused all these days. :)

Thanks for the reminder.

Here is the promised sample.

Please replace myDynamicCount to a suitable integer value, in the code.

Please replace all the paths used in the file with correct paths as per your directory structure. ( path to the javascript, path to the swf, path to FusionChartsRenderer.jsp )

Hope this helps!

Srividya

DynamicChartsExportExample.zip

Share this post


Link to post
Share on other sites

Hello, I have 4 charts on a page that I want to merge together "batch" as a PDF and save on the server with one click of a button. Can you please help me with that using PHP?

 

 

 

 

 

thank you for your time.

 

 

 

pat

Share this post


Link to post
Share on other sites

:)Hi

Give me some time, I will try to come up with a small example.

Thanks for your patience. smile.gif

Srividya

will be more appreciated , if you could share us the sample application file, thanks in advance

Share this post


Link to post
Share on other sites

Hi,

 

This feature was supported while rendering Flash charts and it has been deprecated. Batch exporting of charts are not supported in JavaScript mode. 

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