Sign in to follow this  
nemesis256

Server-side exporting in 3.4

Recommended Posts

Currently with 3.2.2, we have a script that loads charts one by one in the browser and saves them as an image on the server. This is done using the FC_Rendered (to trigger the export handler) and FC_Exported (to do window.location to load the next chart) functions. In the documentation for 3.4, the deprecated section says this is possible ("Render chart at server-side to download it as image/PDF of the chart"), but the page on exporting says it's not. I get a feeling that the page on exporting is the correct one, so when will I be able to do this with a new version?

Share this post


Link to post
Share on other sites

Currently with 3.2.2, we have a script that loads charts one by one in the browser and saves them as an image on the server. This is done using the FC_Rendered (to trigger the export handler) and FC_Exported (to do window.location to load the next chart) functions. In the documentation for 3.4, the deprecated section says this is possible ("Render chart at server-side to download it as image/PDF of the chart"), but the page on exporting says it's not. I get a feeling that the page on exporting is the correct one, so when will I be able to do this with a new version?

Hi,

 

Could you please confirm if you are trying to export a chart on the server side without rendering it on the browser?

 

In case yes, currently, we can provide the following 2 solutions.

 
1. FCImg : This s a free PHP library that allows you to generate PNG and JPEG images of your charts on the server, without even rendering the chart in a browser. It renders the JavaScript version of FusionCharts at the server and and then internally uses the open-source wkhtmltoimage shell utility to convert the charts to images.
 
2. Using wkhtmltoimage/PhantomJS : The charts are exported without being rendered in the browser using wkhtmltoimage is a simple shell utility to convert HTML to images.
 
Hope this helps. :)
 

Share this post


Link to post
Share on other sites

Thanks for the reply.

 

The FusionCharts documentation states:

Currently, the charts can only be exported using the hosted FusionCharts Suite XT Export handler service. We intend to ship a self-hosted Export Handler module next quarter.

 

Is this self hosted export you guys are planning going to be easier or better than the two methods you mentioned? Will the next version of FusionCharts still work with these two methods? Is the self hosted export handler going to have an extra cost with it? When do you guys plan to release this? Depending on the answers to these questions, we may wait to upgrade.

Share this post


Link to post
Share on other sites

Thanks for the reply.

 

The FusionCharts documentation states:

Currently, the charts can only be exported using the hosted FusionCharts Suite XT Export handler service. We intend to ship a self-hosted Export Handler module next quarter.

 

Is this self hosted export you guys are planning going to be easier or better than the two methods you mentioned? Will the next version of FusionCharts still work with these two methods? Is the self hosted export handler going to have an extra cost with it? When do you guys plan to release this? Depending on the answers to these questions, we may wait to upgrade.

Hi,

 

Please note that currently the charts can only be exported via FusionCharts public server. When we support the self-hosted server, you can set it up on your own server and do not need to interact with our server.

 

The method will remain same but only the process to set it up on your own server would be an additional task.

 

Yes, FusionCharts would continue to work with the 2 methods mentioned.

 

No additional cost would be charged for the self-hosted server as this would be supported by our product. We do not have any committed timeline for the release as we are currently working on the same.

 

Hope this clarifies your queries. :)

Share this post


Link to post
Share on other sites

So I'm getting this working using the wkhtmltoimage method, and I have a couple problems. The most serious one is the image here. Any bar charts are missing the color for the bar, and appear as white instead. This affects any bar or column charts. Pie charts work fine.

 

Another problem, although not as serious, is logarithmic charts. The lines on the charts show up correctly, but the background lines showing the logarithmic scale are missing.  On all charts, the background lines that helps separate the big background bars are missing (this can be seen in the image below).

 

Is there anything I can do about these problems? When looking at the page I'm using to render the charts in my browser, it looks fine.

 

19744.jpg

Edited by nemesis256

Share this post


Link to post
Share on other sites

After some debugging, I suspect that wkhtmltoimage doesn't like some SVG attributes. In FusionCharts, the bar charts are missing fill in the style attribute of the rect tag, and are instead drawn using the fill attribute. When I applied the CSS rect {fill: #004B8D;}, exporting the bar chart worked fine. Unfortunately I need multiple colors on a few charts, so this is not a very good solution yet.

 

As far as the lines missing, it seems to be because of the d attribute of the path tag. I know nothing about SVGs, and not sure if this one is fixable.

 

edit: I haven't been using the FusionCharts paletteColors attribute to set the colors. I suspect that's why I don't have a fill in the style attribute.

Edited by nemesis256

Share this post


Link to post
Share on other sites

Finally figured it out. I had to set usePlotGradientColor = 0 for the bar colors to show up. As far as the lines, using divLineIsDashed works.I would prefer solid lines, but it's better than nothing.

Share this post


Link to post
Share on other sites

Finally figured it out. I had to set usePlotGradientColor = 0 for the bar colors to show up. As far as the lines, using divLineIsDashed works.I would prefer solid lines, but it's better than nothing.

Hey.

 

Hope your issue is resolved.

 

Happy FusionCharting! :)

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