## JavaScript events raised by the chart
All the charts in FusionCharts v3 suite can raise the following events. Please note that the events are raised only when registerWithJS flag of the chart is set to 1.
Event Name | When is it raised? | What to use it for?
FC_Loaded(DOMId) | When the chart SWF has finished downloading in the user's browser. | To hide any loader components that you might have on your page.
FC_Rendered(DOMId) | When the chart has finished rendering. This call is made only once per loaded chart SWF (even if new data is supplied to it via setDataURL or setDataXML method). | To invoke any further JavaScript methods on chart, or to change the data of chart.
FC_DataLoaded(DOMId) | When the data of the chart has finished loading - both in dataXML or dataURL method. | To further process data in any other components in your page.
FC_DataLoadError(DOMId) | When there was an error in loading data from the specified URL | To show an error message to user, or to take a corrective measure
FC_NoDataToDisplay(DOMId) | When the XML data loaded by chart didn't contain any data to display | To show an error message to user, or to take a corrective measure
FC_DataXMLInvalid(DOMId) | When the XML data loaded by chart was invalid (wrong XML structure) | To show an error message to user, or to take a corrective measure
How to track these events?
The events raised by FusionCharts are simple JavaScript functions that are invoked, and the DOMId of the invoking chart is passed to the function to help you identify the source. For example, the FC_Rendered event for a chart can be tracked using following code:
<HTML> <HEAD> <TITLE>FusionCharts & JavaScript - Basic Example</TITLE> <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> //FC_Rendered method is called whenever a FusionCharts chart on the page //has finished initial rendering. To this function, the chart passes its //own DOM Id. function FC_Rendered(DOMId){ //If it's our required chart if (DOMId=="chart1Id"){ //Simply alert window.alert("Look Ma! I am Column3D and I've finished loading and rendering."); return; } } </SCRIPT> </HEAD> <BODY> <div id="chart1div"> FusionCharts </div> <script language="JavaScript"> var chart1 = new FusionCharts("../../FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1"); chart1.setDataXML("<chart><set label='A' value='10' /><set label='B' value='11' /></chart>"); chart1.render("chart1div"); </script> </BODY> </HTML>