Sign in to follow this  
venkatc

Fusioncharts.addeventlistener() Static Funstion For Multiple Charts.

Recommended Posts

Hi ,

 

We are creating 5 charts on fly in one dynamic <div> with different chart id's. How can i add "FusionCharts.addEventListener() " to all the 5 charts.

 

sampleCode :

 

 

displayTempChart = function(divId,path,xml,width,height, chartIdName){

var chiefExecutiveChart = new FusionCharts(path, chartIdName + suffix, width, height,'False', 'False', 'True');

chiefExecutiveChart.setDataXML(xml.join(""));

chiefExecutiveChart.render(divId);

 

};

 

displayTempChart() method will call 5 times with different parameters.

 

Can you please advice how can i add "FusionCharts.addEventListener()" to dynamically created charts.

 

I want to use this in Image export functionality. Once fusion chart rendering is completed i will call "exportChart()" chart.

 

 

 

Please advice.

Share this post


Link to post
Share on other sites
Guest Bindhu

Hi Venkat,

 

Can you please try using the code below,

 

Ref. Code:

myChart.addEventListener("Rendered", function () {
FusionCharts("myChartId").exportChart(); 
} );

 

This piece of code starts exporting of image automatically, as soon as that chart is rendered.

 

For demo on the same, please refer to the link below,

http://docs.fusioncharts.com/charts/Code/ExportChartSamples/ClientSide/Auto.html

 

Hope this helps!

Edited by Bindhu

Share this post


Link to post
Share on other sites

Hi Venkat,

 

Can you please try using the code below,

 

Ref. Code:

myChart.addEventListener("Rendered", function () {
FusionCharts("myChartId").exportChart(); 
} );

 

This piece of code starts exporting of image automatically, as soon as that chart is rendered.

 

For demo on the same, please refer to the link below,

http://docs.fusioncharts.com/charts/Code/ExportChartSamples/ClientSide/Auto.html

 

Hope this helps!

 

 

 

Hi Bindhu,

 

Thanks for your reply.

 

With given code i am able to export only one image. I want to export total 5 images.

 

Code

 

displayTempChart = function(divId,path,xml,width,height, chartIdName){

var chiefExecutiveChart = new FusionCharts(path, chartIdName + suffix, width, height,'False', 'False', 'True');

chiefExecutiveChart.setDataXML(xml.join(""));

chiefExecutiveChart.render(divId);

chiefExecutiveChart.addEventListener("Rendered", function () {

FusionCharts(chartIdName + suffix).exportChart();

} );

};

 

 

Above function will call 5 times with dynamic chart id's "chartIdName + suffix" and dynamic swl files. We are using below swf files.

 

 

1. MSCombiDY2D.swf

2. SelectScatter.swf

3. SelectScatter.swf

4. SelectScatter.swf

5. Pie2D.swf

 

 

I am able to export only Pie2D.swf chart, reaming charts are not exported.

 

Pleasse advice am i missing anyting.

 

 

If I use below code image export is working file. But I have other issue( Some times i am getting same images for all 5 exports and "hasRendered()" is not a function). So i want to do this using "addEventListener()"

 

var chartObjectRankExport = getChartFromId("rankComparisonPdfChart" + suffix);

if(chartObjectRankExport .hasRendered()){

chartObjectRankExport .exportChart();

}

 

var chartObjectFixedVsVariable = getChartFromId("fixedVsVaraiblePdfChart" + suffix);

if(chartObjectFixedVsVariable .hasRendered()){

chartObjectFixedVsVariable .exportChart();

}

 

.

.

.

 

Please advice.

Share this post


Link to post
Share on other sites

Hi Venkat,

 

Do you want to export all the charts at once?

 

If yes, then please try using the Batch Export feature.

 

For more details on 'Exporting Charts as PDF or Images > Batch export', please erfer to the link below,

http://docs.fusioncharts.com/charts/contents/?exporting-image/batch-exporting/ECBatchOverview.html

 

Hope this helps!

 

 

 

Hi Bindhu,

 

 

I want to export at server side. I want to export images automatically with out clicking any button.

 

I think Batch Export we have to click the button.

 

Please advice.

 

Thanks,

Venkat

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi Venkat,

 

As you have mentioned, FusionCharts does not have the feature of server side exporting of multiple charts at a time, without any click button.

 

However you can use the "addEventListener()" method (as suggested by Bindhu: Posted 31 May 2012 - 03:59 PM) to export all the charts automatically but you need to provide different JavaScript Variable names for different FusionCharts Objects while looping, for each chart with different chart IDs.

 

Hope this helps!

Share this post


Link to post
Share on other sites

Hi Venkat,

 

As you have mentioned, FusionCharts does not have the feature of server side exporting of multiple charts at a time, without any click button.

 

However you can use the "addEventListener()" method (as suggested by Bindhu: Posted 31 May 2012 - 03:59 PM) to export all the charts automatically but you need to provide different JavaScript Variable names for different FusionCharts Objects while looping, for each chart with different chart IDs.

 

Hope this helps!

 

 

Hi Sashibhusan,

 

Thanks for your reply.

 

We are provide different JavaScript Variable names for different FusionCharts Objects each chart and with different chart IDs also with "getChartFromId()" method and it is working file. Some times we are getting same fusion chart image for different fusion charts also( we've come across 2 instances in which the fusion charts are appearing incorrectly out of 20 instances).

Please advice how i solve this.

 

Thanks,

Venkat.

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Thank you for your feedback.

 

Please make sure that all the charts will have unique Chart IDs, JavaScript Variable names and they all are rendering in different DIV container with unique DIV Ids.

 

If the problem still persists, then could you please provide the code snippet to look into this issue?

 

Awaiting your response!

Share this post


Link to post
Share on other sites

Hi,

 

Thank you for your feedback.

 

Please make sure that all the charts will have unique Chart IDs, JavaScript Variable names and they all are rendering in different DIV container with unique DIV Ids.

 

If the problem still persists, then could you please provide the code snippet to look into this issue?

 

Awaiting your response!

 

 

Hi Sashibhusan,

 

Thanks for your reply.

 

 

I solved this issue. Problem with fusion chart version. Now I am using V3.2.2.

 

Thanks,

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi Sashibhusan,

 

Thanks for your reply.

 

 

I solved this issue. Problem with fusion chart version. Now I am using V3.2.2.

 

Thanks,

 

Hi,

 

Its glad to know that your is resolved.

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