Demos

Beginner's Guide

Charts / Gauges / Maps Guide

Customizing Charts

API

Integrating With Your Stack

Help

Loading

To setup a private export server in Java, you will need the official J2EE export handler provided in the FusionCharts package. The export handler will provide the necessary files to configure the export server. It will handle all exporting requests sent by the user and generate the chart in the requested format. The J2EE export handler is dependent on two external modules—Inkscape and ImageMagick—for conversion. These modules need to be downloaded and installed separately on the same server.

Starting FusionCharts Suite XT v3.11.0, Inkscape and ImageMagick are no longer required for browsers with canvas support.

How does it work?

Step 1: A chart is rendered in the browser.

Step 2: When an export option is selected, the chart generates the SVG string that represents the current state and sends it to the export server.

Step 3: The export server captures the SVG string.

Step 4: The export server invokes a system call, triggering Inkscape to convert the FusionCharts generated SVG string (which is passed to the server-side script over AJAX) to PDF, PNG, and SVG. However, Inkscape still has a limitation of generating a JPG file. Hence, ImageMagick is used to create the JPG files.
To export chart data as XLS, the CSV data generated from the charts is converted to the XLS format.

Starting FusionCharts Suite XT v3.11.0, images are processed on client-side for modern browsers (with canvas support). This eliminates the use of third party software like Inkscape and ImageMagick for server-side as well as client-side exporting.

Step 5: The export handler either writes the exported chart/chart data to disk, based on the configuration provided by the chart, or streams it back to the user as a download.

Starting v3.11.0, FusionCharts supports exporting chart data as XLS. To export chart data in the XLS format, using server-side exporting, it is mandatory that the exporting server has the latest code, which is available in the FusionCharts package. Alternatively the FusionCharts export link, export.api3.fusioncharts.com, can also be used.

Installation

Step 1: Setup a Windows/Linux based server with administrative access to install the export handler. This is particularly important if you are using a shared hosting service for your web server.

Step 2: Install Inkscape and ImageMagick as both these modules are necessary dependencies for the J2EE export handler to work.

Starting FusionCharts Suite XT v3.11.0, Inkscape and ImageMagick are no longer required for browsers with canvas support.

Step 3: Copy files from the FusionCharts J2EE Export Handler to the server.

Step 4: Add the following servlet mapping in your application’s web.xml:

<servlet>
    <display-name>FCExporter</display-name>
    <servlet-name>FCExporter</servlet-name>
    <servlet-class>com.fusioncharts.exporter.servlet.FCExporter</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>FCExporter</servlet-name>
    <url-pattern>/JSP/ExportExample/FCExporter</url-pattern>
</servlet-mapping>

Step 5: Modify the url-pattern as per your application needs.

Step 6: Set the path to the folder where the generated image is to be saved on the server, in the fusioncharts_export.properties file, inside the Classes directory.

Step 7: Set the configuration for the Inkscape and ImageMagick path, only for the Windows Environment.
Open the fusioncharts_export.properties file present in the Classes directory and make the following changes:

# Please specify the path to a folder with write permissions
# The exported image/PDF files would be saved here (for Linux based server SAVEPATH should be changed to relative or absolute path accordingly)
SAVEPATH = /JSP/ExportExample/ExportedImages/

# This constant HTTP_URI stores the HTTP reference to
# the folder where exported charts will be saved.
# Please enter the HTTP representation of that folder
# in this constant e.g., http://www.yourdomain.com/images/
HTTP_URI = http://localhost:8081/ExportHandler/JSP/ExportExample/ExportedImages/

# OVERWRITEFILE sets whether the export handler would overwrite an existing file
# the newly created exported file. If it is set to false the export handler would
# not overwrite. In this case if INTELLIGENTFILENAMING is set to true the handler
# would add a suffix to the new file name. The suffix is a randomly generated UUID.
# Additionally, you can add a timestamp or random number as additional prefix.
FILESUFFIXFORMAT = TIMESTAMP
OVERWRITEFILE = false
INTELLIGENTFILENAMING = true

# Set the path of Inkscape here(Only for Windows)
INKSCAPE_PATH = C:\\Program Files (x86)\\Inkscape

# Set the path of ImageMagick here(Only for Windows)
IMAGEMAGICK_PATH = C:\\Program Files\\ImageMagick-6.9.0-Q16


Inkscape

Inkscape is an open source vector graphics editor. What sets Inkscape apart is its use of Scalable Vector Graphics (SVG), an open XML-based W3C standard, as the native format. Inkscape has a powerful command line interface and can be used in scripts for a variety of tasks, such as exporting and format conversions.
For more details, click here.

ImageMagick

ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files. The software mainly consists of a number of command-line interface utilities for manipulating images.
For more details, click here.

Configuring the export server

To use the private export server, the following attributes need to be configured correctly in the chart.

Attribute Name Description

exportEnabled

Set to 1 to enable exporting the chart.

exportAtClient

Set to 0 to enable export via a Private Export Server.

exportHandler

Set to the absolute path of the export handler, for example: http://www.example.com/fcExportHandler/FCExporter

exportAction

Set to save to store the exported file on the private export server itself. Set to download to send the file back to the user (client) for download.

Top