You are viewing documentation for an older version. For current documentation - click here.

Using the Export Component JavaScript object, you can also over-ride the export parameters that you've specified for each chart in XML. This is particularly useful in particular scenarios:

  • When your XML has parameters related to server-side export (say saving on server-disk) to be used by some part of code in that page. But if you also want your user to be able to instantly download a snapshot of the chart (using client-side exporter) by calling another routine. In this case, when the user clicks on a button, you can over-ride the export parameters specified in the XML (set exportAtClient to 1, specify client-side exportHandlers) and then start export routine.
  • When in a batch mode, you do not want the charts to show Export Dialog box. You can then over-ride the show dialog box property at run-time, thereby eliminating the need to specify the same in XML. So, when users export individual charts, they do see the dialog box. But, when your batch process starts, the dialog can be hidden, thereby enabling the process to carry on silently in the background.
  • Change call-backs at run-time, depending on your application
  • Change export format and file name at run-time, if needed

The list of parameters that can be over-ridden this way is as under:

Attribute Name Value Type Description
exportHandler
string In case of server side exporting, this refers to the path of the server-side export handler (the ready-to-use scripts that we provide).

In case of client-side exporting, this refers to the DOM-Id of FusionCharts Export component that is embedded in your web page, along with the chart.

exportAtClient
boolean
(0/1)
Whether to use client side export handlers, or server side export handlers.

Note: By default the value is set to 0 which means the export is supposed to be done at server-side.

showExportDialog
boolean
(0/1)
Whether to show the export dialog during capture phase. If not, the chart starts capturing process without the dialog visible.
exportFormat
string
('PNG' / 'JPG' / 'PDF')
You can choose the format in which the chart is exported.
exportFileName
string Using this attribute you can specify the name (excluding the extension) of the file to be exported.

When server-side–save export is specified this attribute must provide the relative path of the destination file that is going to be saved to the server.
e.g. “../gallery/charts/myExpenseChart”

exportAction
string
('download' / 'save')
In case of server-side exporting, the action specifies whether the exported image will be sent back to client as download, or whether it'll be saved on the server.

Note: Thus is only available for server side export.

exportTargetWindow
string
('_self' / '_blank')
In case of server-side exporting and when using download as action, this lets you configure whether the return image/PDF would open in same window (as an attachment for download), or whether it will open in a new window.

Note: Thus is only available for server side export.

exportCallback
string This attribute specifies the name of the callback JavaScript function which would be called when the export event is complete.

The internal JavaScript function FC_Exported is the default method that will be called when no value specified.


An Example

Let's quickly see an example how to hide the Export dialog box of all charts during a batch process. To do so, we just add the following line to our export component code:

<script type="text/javascript">
   //Initialize Batch Exporter with DOM Id as fcBatchExporter
   var myExportComponent = new FusionChartsExportObject("fcBatchExporter", "../../FusionCharts/FCExporter.swf");
   //Add the charts to queue. The charts are referred to by their DOM Id.
   myExportComponent.sourceCharts = ['myChartId1','myChartId2','myChartId3'];
   //------- Export related Attributes ------//
   myExportComponent.exportAttributes.showExportDialog = '0';
   //------ Export Component Attributes ------//
   //Set the mode as full mode
   myExportComponent.componentAttributes.fullMode='1';
   //Set saving mode as both. This allows users to download individual charts/ as well as download all charts as a single file.
   myExportComponent.componentAttributes.saveMode='both';
   //Show allowed export format drop-down
   myExportComponent.componentAttributes.showAllowedTypes = '1';
   //Cosmetics 
   //Width and height
   myExportComponent.componentAttributes.width = '350';
   myExportComponent.componentAttributes.height = '140';
   //Message - caption of export component
   myExportComponent.componentAttributes.showMessage = '1';
   myExportComponent.componentAttributes.message = 'Click on button above to begin export of charts. Then save from here.';
   //Render the exporter SWF in our DIV fcexpDiv
   myExportComponent.Render("fcexpDiv"); 
</script>

See it live!

As you can see above, the format is:

export_object.exportAttributes.parameter='value';

When you run the above example and initiate batch export, you'll see that the capturing phase does not show export dialog any more. This saves you the trouble of specifying the parameter in each chart's XML.