soppie

Addeventlistener Fusioncharts.renderchart

Recommended Posts

I use FC for quite some time now, without any problems, but now I'm stuck when trying to add an EventListener.

Saving and downloading techniques are known to me and working fine.

In a new project I want to save the chart to disk after rendering is complete like in the example http://docs.fusioncharts.com/charts/Code/ExportChartSamples/ClientSide/Auto.html

 

I get my data from a database, and I put it all together in a literal which I add to my .net page like this:

 

outPutThis = FusionCharts.RenderChart("FusionCharts/StackedColumn3D.swf", "", StringbuilderxmlData.ToString(), "CountByTypePerYear", "1200", "400", False)

MyLiteral.Text = outPutThis

 

How do I add this part to the rendered javascript in the literal:

 

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

 

 

Thx!


 

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Welcome to FusionCharts Forum!

 

In the .aspx, you would need to access the chart id. Here in your code, you have specified "CountByTypePerYear" as your chart id.

 

So, you would need to create a JavaScript reference in the .aspx page and you can call the addEventListener function over this reference.

 

Ref. Code:

<script type="text/javascript">

 var chartRef = FusionCharts("CountByTypePerYear");

 chartRef.addEventListener("Rendered", function () { FusionCharts("CountByTypePerYear").exportChart();  } );

</script>

 

For more information, please refer the following link:

http://docs.fusioncharts.com/charts/contents/JavaScript/JS_ChartInstance.html

 

Hope this helps!

Share this post


Link to post
Share on other sites

Thx, but tried that already.

This giving me an javascript: Cannot call method 'addEventListener' of undefined

So I thought this wasn't the way to do it.

 

I use a Masterpage, could that be the cause?

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Apologies for the delay.

 

Can you please try following attached illustration at your end? and let us know your feedback?

 

If this does't help to resolve your issue, please send us the sample project for testing purposes.

 

Export_ServerSide(PDF).zip

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