Sign in to follow this  
zhanng

Can't automatically save a JPEG

Recommended Posts

 

The chart will appear within this DIV. This text will be replaced by the chart.

 

 

//Create the chart. Make sure registerWithJS is set to 1, else callback cannot happen.

 

var myChart = new FusionCharts("/recovery/charts/MSColumn2D.swf", "myChartId", "530", "300", "0", "1");

 

myChart.setDataURL("/recovery/charts/chartdata.xml");

 

myChart.render("chartdiv");

 

 

Share this post


Link to post
Share on other sites

Has anyone successfully automated this process? Does anyone have a sample that I could look at that works properly? While I am sure that the example posted in the documentation works in some situations, it doesn't work in mine. Is there some other configuration that is possibly required? What is most revealing is that the call back function isn't called anywhere at all. My understanding is that by specifying the callback function in the tag of a loaded fusionChart that it would fire. Is there more to this than that?

Share this post


Link to post
Share on other sites

I am not exactly sure why there is such a delay in response to my question, but any information would be greatly appreciated. Is there some fundamental misunderstanding in my approach? My overarching goal is to automatically create a JPG for each fusion chart currently being drawn on our site. This is specifically for the iPhone, or any other medium that doesn't support Flash. The idea was simple, create a utility that would automatically create a JPG file for all of our charts and store them in a fixed directory with a fixed name ... then, if we detect that a browser doesn't support flash, we would display the JPG instead. It seems very simple, and it seemed like your export feature supports this with the server side saving as a JPG. Am I correct?

 

 

 

I had planned to create a page with all of our fusion charts on it which was purposed for saving all the charts as JPGs, however I can't even get a single Javascript function to fire, let alone save. I can save fine on the client side, but no response on the server side. Please provide me with some more detail to point me in the right direction.

 

 

 

Thanks again

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey,

 

 

 

Apologies for the delay in the reply.

 

 

 

You correct in thinking that FusionCharts supports server side export saving as a JPG. :(

 

 

 

Could you please re-attach your HTML and XML files to your post? Try to zip them and then attach them.

 

 

 

Just a thought till you make your next post, verify whether the registerWithJs is enabled or not.

 

 

 

Looking forward to your post. :)

Share this post


Link to post
Share on other sites

Hello Again,

 

 

 

I have attached my code. It is very straight forward. You will note that in the callBack function I have an alert() call at the very top. I have tried everything I can, but I can't get that alert to fire.

 

 

 

Please let me know what you think.

source.zip

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Thanks for the code.

 

 

 

Your code works perfectly in our labs with the alerts.

 

 

 

We have only modified your paths (in HTML as well in XML) to suit our path structure.

 

 

 

Please make sure that all the paths that you are specifying are correct.

 

 

 

* Please chek first the path for exportHandler. Try once with download option to see whether the exportHandler file is actually getting accessed and called. In XML you can set path relative to the HTML rather than making it relative to the whole site.

 

 

 

 

 

2. If you find that the download is working, please see the folder write permission.

 

 

 

Waiting for your reply as well wishing to sholve your issue as fast as possible.

Share this post


Link to post
Share on other sites

I am sorry for the delayed response, but I was pulled onto another project and had to put this on hold for a while.

 

 

 

I need a little clarification on how you got this code working, however. It doesn't work on my machine at all. Lets start with the FCExporter.php file. In this file, I had to make changes to the SAVE_PATH and HTTP_URI, the rest I left at default. For the save path, I started by trying to point it to my images directory, which apache has write permissions to (I even chmod 777 it to be sure). Then I tried all sorts of things, but nothing works.

 

 

 

Just to be sure, specifying SAVE_PATH as "/" is the root of the webserver, so I would map HTTP_URI to 'www.myhost.com', right? Or, should the save path be the full server path like '/opt/data/xxx/yyy/zzz/'? Regardless, I tried both, and neither worked, but I just want to be sure.

 

 

 

Likewise, why isn't my exportCallback function firing at all? Even if the save path is incorrect, shouldn't the first alert fire, then the error alert afterwards stating that the file wasn't written? What do I need to check to make sure that the exportCallback function fires?

Share this post


Link to post
Share on other sites

I understand that this is an abstract problem, and possibly even a server issue considering you claim it works on your machines while it doesn't on mine. However, any suggestions on this matter would be greatly appreciated.

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