FusionCharts for Flex > Exporting as Image/PDF > Using Context Menu

Charts/Widgets can be easily exported from the context menu. For that you need to right click on the chart/widget and then select the export format to which you want to export the chart/widget. A save dialog box will be launched allowing you to save the chart/widget in a location of your choice. The entire process seems very simple from the client-side as the user will not get to witness the complex process that is carried out in the background. In order to implement this feature, you need to configure the context menu with the help of XML attributes.

Setting Export Parameters

Export parameters are defined in FCParams attribute. These parameters determine the functionalities that will be supported by the export process, such as export file name, possible export formats, etc. The following code uses exportEnabled and exportFileName attributes.

...


// Variable to be binded to FCParams attribute in FusionCharts tag
[Bindable]
private var chartParams:ArrayCollection=new ArrayCollection([
{ caption:'Half Yearly Sales Summary' },
...
{ exportEnabled:'1' },
{ exportFileName:'myExportFile'}

]);
...

The exportEnabled property allows export of chart/widget from context menu and the exportFileName property defines the default name of the file to which the exported chart/widget will be saved.

For a full list of XML export attributes, visit the Export Attributes section.

Initiating Export

The image (below) shows the export process in action. To export, the user needs to select a desired export format from the context menu, which can be opened by right clicking the chart/widget. The user will then be presented with a save dialog box containing the default file name for the exported chart/widget. The user have to specify a location and saves the image of the chart/widget.

Context Menu