piyush@fusioncharts

Fusion Chart V3 : Server Side Export of chart - Initiation through custom link and not using context menus

Recommended Posts

Hi,

 

 

 

I am using fusion chart v3 evalution version for testing right now. we are planning to buy the commercial version of the same.

 

 

 

while testing export chart api with fusion chart v3 i come across below issue.

 

 

 

I am using server side export handler to export chart as PDF/Image as i need to save the PDF/Image to server disk for later use.

 

 

 

So here i am able to export chart using context menu export method. but i need to pass other custom parameter also to the handler method in controller with necessary xml attributes. so how can i pass these parameters ?? also if i do not want to initiate export process through context menu by doing right click on chart but want to initiate export process on click event of custom export link then how can i do that ??

 

 

 

Please reply asap.

 

 

 

Thanks,

 

Piyush

Share this post


Link to post
Share on other sites

Hi Piyush,

You can use javascript to initiate the export. Here is the code:

<script type="text/javascript">
   function ExportMyChart() {
        var chartObject = getChartFromId('myChart');
        if( chartObject.hasRendered() ) chartObject.exportChart();
   }
</script>  

You can use your custom controller to handle the export, by specifying the exportHandler value in the xml.

You cannot provide custom parameters to your controller, from the chart.

The one way, you could achieve this is by using the existing attributes with a different meaning in your controller.

For example: exportTargetWindow or exportAction.

You could use these attributes as something else in your controller.

Hope this helps.:)

Srividya

Share this post


Link to post
Share on other sites

Thanks for your reply Srividya.

 

 

 

I have one more question here regarding registartwithJS option. in the documentation it is mentioned that we need to set this attribute at true to enable chart export initiation through javascript but it is not clear that where to set this attribute ?? is it as one of the parameter in the chart xml ??

 

 

 

Thanks,

 

Piyush

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello Piyush,

 

 

 

Here, you would have to use the parameter 'register_with_js' and set it to true.

 

 

 

To register the chart with JavaScript, we set the registerWithJS parameter to 1. It's the last parameter in FusionCharts constructor function.

 

 

 

var chart1 = new FusionCharts("../../FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");

 

 

 

Ref.- http://www.fusioncharts.com/docs/?JS_Overview.html

 

 

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi Piyush,

If you are using the render_chart function in the view, you could set the registerWithJS value as follows:

#Create the chart - Column 3D Chart with data contained in str_xml
render_chart '/FusionCharts/Column3D.swf', '', str_xml, 'productSales', 600, 300, false, truedo-%>

Srividya :)

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