Ruby on Rails
To setup a private export server in Ruby on Rails, you will need to install the official RoR export handler in your project. The export handler will handle all exporting requests sent by the user and generate the chart in the requested format. The FusionCharts RoR 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 XLSX, the CSV data generated from the charts is converted to the XLSX format.
FusionCharts Suite XT v3.11 onwards processes images on the client-side for modern browsers (with canvas support). This eliminates the use of third party softwares 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.
Step 1: Add this line to your application's Gemfile: