Categories: Tutorials

Export your charts as images or PDFs

How often does this happen to you – you create a stunning information-intensive chart after a lot of hard work for your web page and then intend to embed the same in your annual report? Or mail it to one of your colleagues? But since you have no easy way to export the chart from the web page, you have to create the chart all over again. What if all of that could be done as simply as in the screenshot below?

Yes, with FusionCharts Suite XT, you can do it with one single click. Any chart in FusionCharts v3.1 can be configured to be exported as an image (JPEG or PNG) or a PDF file by the end user. This can be done either on the server-side or on the client-side. Before we get into slightly technical details of the same, here’s a live demo of the same that you might want to see to get a better grasp of things. Now, FusionCharts by itself cannot directly export the charts as images. It needs help either from server-side scripts, or other client side Flash movies (coded in Flash 10) to accept the bitmap snapshot sent by FusionCharts, and to convert that into an image or PDF. These are called FusionCharts Export Handlers. The export handlers come in 2 flavors: Server-side Handlers & Client-side Handlers. Let’s look into each of them in details.

Server-side Export Handlers

The server-side export handlers help you export FusionCharts as images/PDF with the help of scripts that are placed on your servers. We provide ready-to-use scripts for ASP.NET, PHP (uses GD and GZIP library), Ruby on Rails (uses RMagick and zlib) and Java in our Download pack itself. These scripts accept compressed bitmap data from FusionCharts (over HTTP or HTTPS) and convert the same into images/PDFs. Post conversion, you’ve two options:
  • Save the generated output (image/PDF) on the server’s disk. This allows you to use these images later for embedding in your emails/reports.
  • Or, send it back to the browser so that your user can download it.

Client-side Export Handlers

The client-side FusionCharts Export Component, as the name suggests, helps you bypass all server scripts and save the charts as images/PDFs at the client side itself. You would typically use client-side export when your server doesn’t support any of the technologies mentioned in server-side exporting or you don’t want to transfer data between your client and server (which in turn will make the export process faster). Client-side exporting is done using FusionCharts Export Component SWF file (which is coded in Flash 10) and FusionCharts Export Javascript class, both of which are available in the Download pack. In both client and server side exports, you can configure the output formats(PDF/JPEG/PNG) that you wish to make available from your context menu and the cosmetics of the export dialog box itself. You can also make your own custom export panels (with custom buttons, look & feel) somewhere near the chart in a <DIV> and then connect the same to the export handlers of the charts.

Batch Export

Let’s say you have multiple charts on a page and you want to export all of them with a single click. In comes batch export. You can make use of batch export when you are exporting charts on the client-side. The exported files for each chart can either be saved individually, or all the exported charts can be saved as a single file:

Batch Export can thus be made use of extensively in reporting purposes and dashboards, where the user can save any chart and use it later in reports/emails. To get details on how to implement either server or client side (including Batch export) exporting for your charts, please check out the Exporting as Image/PDF section in our online documentation. In this post, we talked about the feature in FusionCharts v3.1 specifically, but it applies equally well to FusionWidgets, FusionMaps and PowerCharts v3.1 as well. With this blog post, we start our promised series of an in-depth look at the new features of v3.1. Once you know the features inside out, you can use them to render a powerful charting experience. So keep coming back for more…
sanket

View Comments

  • Hi Jason,
    I am afraid, export to PDF (or any other export feature) is not available in FusionCharts Free.
    You need to use FusionCharts v3.1 or above to avail the Export to JOG/PNG/PDF feature.

  • While saving as images at server-side, I am getting applet alerts. Hoe to disable these alerts??

  • @Parxier: Done. Thanks a lot for pointing it out. And sorry we could not grant your wishes here :)

  • Hi,
    Would I need batch export in order to export the chart and its grid on the same file ?
    If so, am I obliged to user client-side export ?
    I've already implemented chart server-side export, and it works fine, until I found out the chart legend (namely the grid) is not found on the exported pdf.
    Thanks

  • @Ranc2: I am afraid grid does not support export feature. As of now batch export is supported at client side until and unless you take some time to modify the export handler code to reopen existing exported image/PDF file (at server) and keep on appending the new images to it.

  • Hi,
    About batch export. Is there a way to generate the graphs on the server-side by a periodic process started on the server by a timer to send them?

Recent Posts

AI-Powered Documentation for Data Visualization & Analytics

Have you ever spent hours buried in documentation, hunting for a specific piece of code?…

2 weeks ago

Unveiling the Hidden Gems: Top 5 AI Data Visualization Tools for 2024

Do you feel like your data is a cryptic puzzle, locked away from revealing its…

1 month ago

Unleash the Power of AI: Smart Charting for JavaScript Developers

In web development, mastering JavaScript charting libraries is crucial for keeping up with the fast-paced…

2 months ago

Focus on the Magic, Not the Mundane: Ask FusionDev AI is Here!

Ever spend an afternoon neck-deep in documentation, searching for that one elusive code snippet? Or…

2 months ago

FusionCharts 4.0: Elevate Your Data Visualization with New Capabilities

In the dynamic world of data visualization, the need for precision and innovation has never…

2 months ago

How AI is Enhancing the JavaScript Charting Experience in 2024

Are you drowning in data but struggling to find the insights that drive real business…

4 months ago