Sign in to follow this  
venkatc

Pure Javascript Export Images(Redirecting To Index.php).

Recommended Posts

Hi Support,

 

 

We are using pure java script fusion charts to display multiple charts in my application.

 

Export Images

 

We need to export the chart at server side.

We Setup your own server to process and export JavaScript charts using highchart server setup in linux (Refernce www.highcharts.com/documentation/how-to-use.).

 

We are exporting total 5 charts at server side. After exporting we need to use those images to generate the report.

 

When we are calling the export chart functionality from javascript(Onclick event). The svg and png images are created in temp folder. But the control is redirecting to index.php from application(Which we configured to export chart).

 

 

How can we stop the redirection from our application to export index.php after exporting the images to "temp" folder.

 

We are using latest version of fusion charts(3.2.3-sr1.5347).

 

Please advice.

Share this post


Link to post
Share on other sites

Hi,

 

When you export a JavaScript chart, it uses normal HTTP FORM POST method to post the SVG and other meta data of the chart to the batik server you have setup at your own location.

 

Let me elaborate on what happens in a generic setup:

 

  1. This POST data is first passed to (from client side chart) index.php which in turn
  2. Asks batik rastarizer Java library to convert that to required format
  3. The Batik library while converting the SVG to required format, saves it in a temporary folder
  4. The Batik library also gives the binary of the exported file back to index.php
  5. index.php finally responses (as postback to the request send at step 1) back the binary as download to the client-side

 

In case, you wan to stop the final step, you need do the following:

 

  1. Instead of calling the exportChart function, build your own function to get SVG data from chart and use AJAX (to stop postback) to pass the SVG and other meta data to the index.php
  2. Modify the index.php to save the exported file from temp to your preferred location
  3. Modify the index.php not to response back the image binary, but to respond back whatever your client-side implementation requires - like export status (success or failure) etc.

Share this post


Link to post
Share on other sites

Hi,

 

When you export a JavaScript chart, it uses normal HTTP FORM POST method to post the SVG and other meta data of the chart to the batik server you have setup at your own location.

 

Let me elaborate on what happens in a generic setup:

 

  1. This POST data is first passed to (from client side chart) index.php which in turn
  2. Asks batik rastarizer Java library to convert that to required format
  3. The Batik library while converting the SVG to required format, saves it in a temporary folder
  4. The Batik library also gives the binary of the exported file back to index.php
  5. index.php finally responses (as postback to the request send at step 1) back the binary as download to the client-side

 

In case, you wan to stop the final step, you need do the following:

 

  1. Instead of calling the exportChart function, build your own function to get SVG data from chart and use AJAX (to stop postback) to pass the SVG and other meta data to the index.php
  2. Modify the index.php to save the exported file from temp to your preferred location
  3. Modify the index.php not to response back the image binary, but to respond back whatever your client-side implementation requires - like export status (success or failure) etc.

 

You wrote:

"Instead of calling the exportChart function, build your own function to get SVG data from chart and use AJAX (to stop postback) to pass the SVG and other meta data to the index.php"

How do I do this? Can you post an example? I'd like to use jquery and AJAX to post the chart myself, then load the image into a new container within the callback from the AJAX post.

Is there a callback when exporting pure javascript charts?

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