Exporting charts as PDF/Images >JavaScript Reference > JavaScript API

 

object FusionChartsExportObject()

Description:
This object contains all the routines that are required for FusionCharts Export Component to work.

infosoftglobal.FusionChartsExportObject()

Note:
This object is dependent upon infosoftglobal.FusionCharts for a few of its internal routines. Hence, it is pertinent that FusionCharts.js be included prior to the definition of this object.

Constructor

FusionChartsExportObject( string id, string swfLocation, object componentAttributes, object exportAttributes, 
    array sourceCharts, boolean debugMode );

Description:
This is used when we need to create a new FusionChartsExportObject().

Constructor Parameter Description:
Parameter Name Type Description
id string

This specifies the DOM ID of the SWF that will be embedded on the HTML page.

 

Note:
This ID is compulsory and must be unique on page as other FusionCharts object will use this ID to locate and access every new FusionChartsExportObject.

swfLocation string

Specify the URL (location) of the FCExporter.swf on your server.

 

Note:
Typically, this is a compulsory attribute. However, in case you have multiple FusionChartsExportObjects on your page, you may define this value centrally at FusionChartsExportObject.defaultParameters.swfLocation

componentAttributes object

[optional] Use this to specify properties of the Export Component SWF file. These attributes are sent as flashVars to the Export Component SWF when it is embedded on the web page.

 

The value of this parameter needs to be entered in {key1: 'value1', key2: 'value2' ... } style. The list of valid attributes can be found in the Component Attributes section.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', {width: '400', height: '100', borderColor: 'FF0000'} );

exportAttributes object

[optional] Use this to specify export attributes for the charts that are being exported. The values in this parameter will override the corresponding value specified in dataXML of the chart(s).

 

The value of this parameter needs to be entered in {key1: 'value1', key2: 'value2' ... } style. The list of valid attributes can be found in the XML Attributes section.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', null, { showExportDialog: '0', exportAtClient: '1' } );

sourceCharts array

[optional] Use this to specify the charts that will be exported in the order of array definition when the BeginExport() function is called. The value of this parameter should be the DOM ID string (chart id) of each chart that you want to export.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', null, null, ['myChartId1', 'myChartId2'] );

 

Note:
Even in case you want to export a single chart, you should provide the single chart id as an array.

debugMode boolean
(true/false)

[optional] Set this parameter to true if you want the Export Component to halt on every error and notify of the nature of the error encountered.

 

A detailed section on how to debug your export component in case you encounter an error can be found in the Debugging Export Component section.

 

Alternative Constructor

FusionChartsExportObject( object arguments );

Description:
The FusionChartsExportObject also accepts an object as the entire parameter for constructor. In this method, the object can be initialized as above with its properties being of the same name as those provided in the "Constructor Parameter Description" table above.

Example:

var myComponent = new FusionCharts( {
id: 'myComponent',
swfLocation: 'FusionCharts/FCExporter.swf', exportAttributes: { exportAtClient: '1',
showExportDialog: '0'
}, debugMode: true
}
);

 

Public Variables and Properties

Name Value Type Description Default Value
checkFlashVersion boolean
(true/false)

This variable, when set to true, checks whether the installed Flash Player in the user's browser meets the minimum requirement (version 10 or above) or not.

 

In case the user does not have the required flash version, it shows a friendly message notifying user of the same.

 

Example Usage:

FusionChartsExportObject.checkFlashVersion = true;

false
defaultParameters object

All new FusionChartsExportObject will have the properties specified within this object.

 

Effectively this allows developers to set global "default" values of every FusionChartsExportObject within the page scope.

 

Example Usage:

FusionChartsExportObject.defaultParameters.debugMode = true;

This enables "debugMode" on all new FusionChartsExportObject

 

Note:

defaultParameters accepts properties as mentioned in the table "Constructor Parameter Description"

object

 

 

Prototyped Variables and Properties

These variables and properties are available for every new instances of FusionChartsExportObject.

Name Value Type Description Default Value
id string

This specifies the DOM ID of the SWF that will be embedded on the HTML page.

 

Note:
This ID must be unique on page as other FusionCharts object will use this ID to locate and access every new FusionChartsExportObject.

undefined
swfLocation string

Specify the URL (location) of the FCExporter.swf on your server.

 

Note:
Typically, this is a compulsory attribute. However, in case you have multiple FusionChartsExportObjects on your page, you may define this value centrally at FusionChartsExportObject.defaultParameters.swfLocation

FusionChartsExportObject.
defaultParameters.
swfLocation
componentAttributes object

Use this to specify properties of the Export Component SWF file. These attributes are sent as flashVars to the Export Component SWF when it is embedded on the web page.

 

The value of this parameter needs to be entered in {key1: 'value1', key2: 'value2' ... } style. The list of valid attributes can be found in the Component Attributes section.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', {width: '400', height: '100', borderColor: 'FF0000'} );

FusionChartsExportObject.
defaultParameters.
componentAttributes
exportAttributes object

Use this to specify export attributes for the charts that are being exported. The values in this parameter will override the corresponding value specified in dataXML of the chart(s).

 

The value of this parameter needs to be entered in {key1: 'value1', key2: 'value2' ... } style. The list of valid attributes can be found in the XML Attributes section.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', null, { showExportDialog: '0', exportAtClient: '1' } );

FusionChartsExportObject.
defaultParameters.
exportAttributes
sourceCharts array

Use this to specify the charts that will be exported in the order of array definition when the BeginExport() function is called. The values of this parameter should be the DOM ID string (chart id) of each chart that you want to export.

 

Example:
var myComp = new FusionChartsExportObject( 'myComp', 'FusionCharts/FCExporter.swf', null, null, ['myChartId1', 'myChartId2'] );

 

Note:

Even in case you want to export a single chart, you should provide the single chart id as an array.

FusionChartsExportObject.
defaultParameters.
sourceCharts
debugMode boolean
(true/false)

Set this parameter to true if you want the Export Component to halt on every error and notify of the nature of the error encountered.

 

A detailed section on how to debug your export component in case you encounter error, can be found in the Debugging Export Component section.

FusionChartsExportObject.
defaultParameters.
debugMode
strictTrigger boolean
(true/false)
This property sets whether to force the "triggering" export component to be the final "processor" of the exported data. FusionChartsExportObject.
defaultParameters.
strictTrigger

 

Protoyped Methods

These methods are available to all new instances of FusionChartsExportObject.

Method Definition Description and Parameters Returns
boolean Render(string containerNode)

This function is called to render the Exporter Component SWF on the current page.

 

Parameters:

containerNode: It is the DOM ID of the HTML element inside which the SWF EMBED HTML is to be written.

 

Note:

The containerNode parameter can also be a direct reference to the HTML DOM element

Whether the render operation was successful or not
array BeginExport() Initiates exportChart sequence on all the charts provided in the sourceCharts array. Array of DOM IDs of all the charts that were successfully exported
array BeginExportAll() Initiates exportChart sequence on all FusionCharts within the current page. Array of DOM IDs of all the charts that were successfully exported
string GetOuterHTML()

Returns the HTML that is to be put in your web page in order to display the Exporter Component.

 

This can be used if you want to manually put in the HTML of the SWF component instead of using the Render()

HTML of the SWF Embed object

 

Public Events

FusionChartsExportObject raises certain events that you can use to integrate the Export Component with the rest of your website.

Event Name Description Return Accepted
void FC_ExportReady( string DOMId)

This event is raised as soon as a chart has finished the capturing phaze and is ready to be relayed to the exporter component, both client-side as well as server-side.

 

You can use this event to track the progress of your export.

 

DOMId: This is the DOMId of the chart (ChartID) that has finished rendering.

 

void