Sign in to follow this  
mravikrish

Download without right click on Chart

Recommended Posts

Hi All,

 

 

 

 

 

I want to download the chart without right clicking on it , is there any function which i can call to save the chart as respective mediums.

 

 

 

Thanks in advance.

 

Ravi Krish

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Please try calling a function, where :-

1) You first you need get the chart id using getChartFromId method

2) Then you need to call the exportChart function using the chart id.

Ref.-


<script type="text/javascript">

   function ExportMyChart() {

        var chartObject = getChartFromId('myChart');

        if( chartObject.hasRendered() ) chartObject.exportChart();

   }

</script>    

For further details please refer to the link below :-

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

Hope this helps. :)

 

Share this post


Link to post
Share on other sites

Hi Basundhara Ghosal,

 

 

 

 

 

Thanks for your quick response. I was able to capture the screen but it is not downloading the chart which doesnt shows popup message to save the file after capturing the chart 100%.

 

 

 

Could u suggest me for further processing.

 

 

 

function ExportMyChart() {

 

 

 

var chartObject = getChartFromId('chart');

 

if( chartObject.hasRendered() ){

 

chartObject.exportChart( { exportAtClient: '1', exportFormat: 'PDF' } );

 

 

 

}

 

 

 

}

 

 

 

Regards,

 

Ravi Krish

Share this post


Link to post
Share on other sites

Hi Rajroop,

 

 

 

Thanks for response,its working fine when right click on the chart but its not working when i use the download button.

 

 

 

Regards,

 

Ravi Krish.

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey,

 

 

 

Could you send us a snap-shot of the error you are viewing when you press the download button?

 

 

 

Looking forward to your response.

Share this post


Link to post
Share on other sites

Hi Rajroop,

 

 

 

I'm not getting any error instead page is getting refreshed after completing 100% capturing.

 

 

 

Regards,

 

Ravi

Edited by Guest

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ravi,

Could you please send us the code as an attachment?

Awaiting your reply.

Share this post


Link to post
Share on other sites

Hi Team,

 

 

 

Here is my code .Suggest me where im wrong.

 

 

 




      function ExportMyChart() {



          var chartObject = getChartFromId('chart1');           

          if( chartObject.hasRendered() ){

          chartObject.exportChart( { exportAtClient: '1', exportFormat: 'PDF' } );       

          }                   

    	}



In Body



<%

        String strXML=(String)session.getAttribute("XML");

        System.out.println("************JSP**************");

	 System.out.println(strXML);

 %> 



jsp:include page="FusionChartsRenderer.jsp" flush="true" 

               jsp:param name="chartSWF" value="../FusionCharts/MSColumn3DLineDY.swf"  

               jsp:param name="strURL" value=""  

               jsp:param name="strXML" value="<%=strXML %>"  

               jsp:param name="chartId" value="chart1"  

               jsp:param name="chartWidth" value="750"  

               jsp:param name="chartHeight" value="400" 

               jsp:param name="debugMode" value="false"  

               jsp:param name="registerWithJS" value="true" 

           /jsp:include 





input type="button" value="Export My Chart" onclick="ExportMyChart()"

 

 

 

Regards,

 

Ravi Krish

Edited by Guest

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ravi,

Could you please confirm whether you have set the value for the attributes "exportEnabled", "exportFormats", "exportAtClient" in your XML code?

Also, could you please confirm whether the root path for the .js file is mentioned correctly?

Please note, in case you wish to save the chart as image/PDF as a download, you need to set the value of the attribute "exportAction" to "download" in your XML codes.

Also, as of now, FusionCharts supports the 'download' action for server-side export and not for client-side export.

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ravi,

You are most welcome.

We are glad to help you.

Keep smiling and keep FusionCharting. :)

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ravi,

We are glad to help you.

Happy FusionCharting. :)

Share this post


Link to post
Share on other sites

Hi Team,

 

 

 

Is there any way to call exportChart() after loading the page to save the chart on server side. i dont want to click on any button nor right click.

 

ive tried calling exportchart() at the end of body tag but no luck it is getting called before the chart is rendered.

 

is there any param of jsp include along with those eight param to call this function when page is loaded.

 

 

 

Please suggest me.

 

 

 

Thanks in advance,

 

Krish

Edited by Guest

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ravi,

Please try calling the export() function inside the FC_Rendered() function so that the chart starts getting exported automatically as soon as it gets rendered on the browser page.

Hope this helps.

Share this post


Link to post
Share on other sites

Hi Team,

 

 

 

Thanks for reply,

 

 

 

Actually im using the below functions exportChart and FC_Exported . When i use button onclick im calling exportchart() which intern calls FC_Exported(objRtn) , but when i use it onload=exportchart() of body tag it gets called before page gets loaded and it doesnt call FC_Exported(objRtn) .

 

 

 

Suggest me how to use thos functions.

 

 

 

function exportChart() {

 

 

 

var chartObject=getChartFromId("graph1");

 

if( chartObject.hasRendered() ) chartObject.exportChart({exportFormat:'JPEG'});

 

 

 

}

 

 

 

function FC_Exported(objRtn){

 

 

 

if (objRtn.statusCode=="1"){

 

alert("The chart was successfully saved on server. The file can be accessed from " + objRtn.fileName);

 

 

 

}else{

 

alert("The chart could not be saved on server. There was an error. Description : " + objRtn.statusMessage);

 

}

 

}

 

 

 

Im attaching the jsp page of mine

 

 

 

 

 

Thanks,

 

Ravi Krish

Chart.zip

Edited by Guest

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