Sign in to follow this  
shamasis

Export Chart as Raw Image Data

Recommended Posts

Hello FusionCharts Support Team,

 

 

 

we have FusionCharts full version and want to get the image data of a fully rendered chart.

 

I know there is a FCExporter.swf file which gets the image data and uses it for some kind of processing.

 

 

 

However, in my case, I have to use this image data, convert it to PNG, encode the data to BASE64 and send the data via a Flex WebService Call to a web server saving the file. There is no other way to do this!

 

 

 

Is there a way to get the raw bitmap data of the charts from another swf file coded in Flex (AS3)?

 

 

 

Example:

 

A chart is embedded as usual. The user clicks at a HTML button "Apply" to save the current state of the chart. In the background the chart gets exported.

 

Now I need to find a way to get the raw bitmap data representation of the chart and transfer it to another SWF file. This other SWF file will encode it to PNG, encode the PNG data to BASE64 data and uploads the data via a Flex WebService Call.

 

 

 

Is there an easy way to do this?

 

It must be some kind of rewriting the FCExporter.swf.

 

 

 

Best,

 

Tobias

Share this post


Link to post
Share on other sites

...

Tobias-L (9/16/2009)

Is there a way to get the raw bitmap data of the charts from another swf file coded in Flex (AS3)?

Yes, you can use the getImageData() function on a chart to get an RLE stream of image. You can correspondingly convert this run-length encoded stream into bitmap or your own purpose. The RLE has semi-colon as row separator, comma as run separator and each run has the color and the run-length separated by an underscore.

In case you are using a TOTAL Flex solution (http://www.fusioncharts.com/flex/), capturing bitmap data of the embedded chart is very simple using native Flex commands as below:

var bmp:BitmapData=new BitmapData(chart.width,chart.height,true);

var matrix:Matrix = new Matrix();

bmp.draw(chart, matrix);

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