Site icon FusionBrew – The FusionCharts Blog

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?

SAI_SaveAsImage

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:

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…
Exit mobile version