FusionCharts Server-Side export

Download

Windows
(8.9 MB Zip)

Linux (32 Bit)
(10 MB Tar.gz)

Linux (64 Bit)
(10 MB Tar.gz)

Current version:
0.1.3

Documentation:

About:

FCImg is a third party tool to allow servers running the LAMP stack to export FusionCharts Charts as images without a need for a browser. It is free of charge, but you still need a FusionCharts license to use it. The download includes a copy of the FusionCharts evaluation version, but you can easily replace it with your licensed copy as described here.

Requirements and Installation:

Download the appropriate package for your platform and extract it in a path that your PHP Scripts can read. Currently, only PHP 5.2 or above is supported. Shared hosts are supported as long as safe_mode is not emabled. (Enabling safe_mode is not recommended and most hosts turn this off)

Usage:

First, require fcimg.php from your PHP script. Now call the fusioncharts_to_image function, with the following arguments in this order:

Example:

require "fcimg/fcimg.php";
fusioncharts_to_image (
    "/var/www/report.png",           // path to image
    "Column3D.swf",                  // SWF Name. SWF File not required
    $inputString,                    // the input XML String
    400, 500,                        // height and width
    array(                           // options
        'imageType' => 'jpg',        // set image type as JPG
        'quality' => 75              // increase Quality
    )
);
                

Notes:

The conversion engine waits 1 second before capturing the state of the chart. In the event that the animation hasn't completed, the result of the chart might not be appropriate. By disabling animation, you can ensure that the exporter provides optimum results.

The conversion process takes upto 2-3 seconds on an average server. The call to fusioncharts_to_image blocks the thread. Thus it is highly not recommended to use this function inside a script that serves web pages.

Instead, this is ideal for background scripts that generates reports, where there won't be concurrent calls to the exporter, and situations where the render time won't introduce latency

For Linux/OSX based servers, the contents of "fcimg/bin" needs to be executable. While this should be enabled by default (GNU tar will preserve file attributes), you can manually set them executable by using the command chmod +x fcimg/bin/*.

Samples:

FusionCharts Javascript

Server-side Export (Image)

Using Licensed FusionCharts

The current process to use a Licensed copy of FusionCharts isn't automated. There will be a Windows BAT script and a Linux BASH script provided in the next release. However, there is an alternative method:

  1. Remove the contents of template.txt found in the fcimg directory
  2. Add the code from this file to the beginning of template.txt
  3. Add all the code from jquery.min.js to template.txt
  4. Add all the code from FusionCharts.js to template.txt
  5. Add all the code from FusionCharts.HC.js to template.txt
  6. Add all the code from FusionCharts.HC.Charts.js to template.txt
Note that the order of files added is important. Also, you need to use a Licensed version of FusionCharts or this will not work.

Support and Bug Reports:

FCImg is a project developed in my spare time, and is released with the hope that people find it useful. If you find some bug or feature request, please email it to me at contact@fcimg.org. It will help if you include details like the XML/JSON data.

SHA1 Sums:

Windows: de1c7f493caf0ff8328c2403ca01a3c10b6f6f22

Linux (32 Bit): 477c8c3dbd1cfda51f58e3cbc98cc7a0339806d0

Linux (64 Bit): baf8ea193a942bf488018eadcc73ad68d8c9b0bb