Sign in to follow this  
Geir Lie

Direct access (IMG SRC data encoded like in Open Flash Charts ) method in javascript

Recommended Posts

Hi,

 

 

 

My company have been looking at FusionCharts and it seems like a very good solution - mostly it is fine but in some areas VERY lacking.

 

 

 

Especially in the "replacing the flash div with real image data" scenario that occurs when one is preparing reports for printing and it would have been nice to avoid the network traffic caused by the export of images and all that.

 

 

 

I DO know that Flash carry limitations with it but there are still solutions out there that are viable for this scenario.

 

Open Flash Charts implements one solution that is SOOO admirable (that is what I call customer satisfaction!!!) where they return data that inline can be loaded by an IMG SRC tag and as such -leave out LOADS of network traffic.

 

 

 

function is described below - copied directly from OpenFlashCharts main.as file.

 

public function getImgBinary():String {

 

 

 

tr.ace('Saving image :: image_binary()');

 

 

 

var bmp:BitmapData = new BitmapData(this.stage.stageWidth, this.stage.stageHeight);

 

bmp.draw(this);

 

 

 

var b64:Base64Encoder = new Base64Encoder();

 

 

 

var b:ByteArray = PNGEncoder.encode(bmp);

 

 

 

// var encoder:JPGEncoder = new JPGEncoder(80);

 

// var q:ByteArray = encoder.encode(bmp);

 

// b64.encodeBytes(q);

 

 

 

//

 

//

 

//

 

b64.encodeBytes(:);

 

return b64.toString();

 

//

 

// commented out by J vander? why?

 

// return b64.flush();

 

//

 

//

 

 

 

 

 

/*

 

var b64:Base64Encoder = new Base64Encoder();

 

b64.encodeBytes(image_binary());

 

tr.ace( b64 as String );

 

return b64 as String;

 

*/

 

}

 

 

 

Why cannot FusionCharts, that are COMMERCIAL, implement a solution like that. I know that it is just a matter of recompiling the charts but that is besides the point - that particular functionality should be there in the first place... Just to make FusionCharts even BETTER!!! Because they are good!!!

 

 

 

(Even though it is completely impossible to render a chart on the fly ( not in a browser window no.... ) thus effectively eliminating the product for my company.

 

 

 

I know that this is a probelm for very many people. I AM aware that one can do client and server side export of the already rendered chart - but I have a situation where I cannot display a webpage before returning the chart!!! I need to create a chart - render it without showing the actual chart and then save it to a file for finally being included in a process to generate a pdf.

 

 

 

Please come back to me on this one - I find it AMAZINGLY strange that you haven't implemented either of these functionalities in a commercial product of this quality....

 

 

 

The javascript in Open Flash charts would replace the div with the code from below:

 

* URL = http://teethgrinder.co.uk/open-flash-chart-2/save-image-js.php"

 

 

 

return "taghere img src='data:image/png;base64," + $('#'+src)[0].get_img_binary() + "' / endtaghere"

 

 

 

It works brilliantly!!!

 

 

 

Server side on the fly chart generating would be brilliant as well - or any other kind of functionality so that I don't NEED to launch a webpage just to have my chart exported as an image...

 

 

 

Thanks

 

 

 

Geir Lie

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Geir,

 

 

 

Thanks for your valued suggestion.

 

 

 

Currently, we cannot implement this in FusionCharts because our code is in AS2, which doesn't support this. However, we do have server-side export support (on Windows stack) and client-side batch export support as well. Additionally, we're soon releasing the new version with HTML5 fallback support as well.

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey Jimbo,

 

 

 

Welcome to our beloved FusionCharts Forum.

 

 

 

We are working on an HTML5 version, as we speak. We'll be sure to announce the release of the same (in a BIG way!) soon!! :)

 

 

 

Thanks for your continued patience and patronage.

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