FusionCharts for Flex > Exporting as Image/PDF > Overview

Starting FusionCharts for Flex v1.1, all charts and widgets of FusionCharts for Flex v.1.1 package are provided with a feature that exports the charts and widgets to image or PDF at client side. The exported files types can be any of the three formats - JPG, PNG or PDF. This just involves setting a few attributes of the chart/widget data. Export can be initiated in following two ways:

  1. Using Context Menu: The user gets to select a desired export option from the context menu of the chart/widget. This is only applicable when proper export attributes have been assigned in the XML data source, while configuring the chart/widget. The event triggered through the context menu is relayed by the chart/widget to the event handlers attached to the SWF.
  2. Using script : The export interface can be invoked by an external function. This external function must be triggered directly or indirectly by the user-interactive event.

The image below shows the export feature in action using context menu.

Export Context Menu

Or if you wish to use Flex script to export, you would need to create a button or some clickable object and call the FCExportChart function of the chart/widget. The code below exports a chart/widget whose id is myChart to a JPG image.

<mx:Button ... click="myChart.FCExportChart('myChart', 'JPG')" />

In following pages we will discuss the chart/widgets attributes that are involved in configuring the export mechanism. Moreover, we will learn using detailed samples how export is done either using context menu or Flex script. We will finally learn the callback event triggered when export completes.


Requirements

Please note that the following components are required for avail the export feature :