|
||||||||||||||||||||
Please note that to trap these events one needs to import com.events.FCEvent class: import com.events.FCEvent;
|
||||||||||||||||||||
These events are described in detail, with the help of code example and screenshots, below. | ||||||||||||||||||||
FCClickEvent Event | ||||||||||||||||||||
When a dataplot's link is defined with a 'S-' prefix the dataplot becomes a hotspot, which can be trapped by FCClickEvent event. You can pass any value after 'S-' that would be passed as a parameter of the event listener function. Thus a developer can use this value to setup further actions for drilldown. For example, you can invoke a message box with a distinct value for each dataplot, when the end viewer clicks on each dataplot on the chart. The actions in the new project would now contain the following: |
||||||||||||||||||||
<?xml version="1.0" encoding="utf-8"?> import com.events.FCEvent; // As registered in the above addEventLister, whenever |
||||||||||||||||||||
The XML for the chart | ||||||||||||||||||||
<chart caption='ABC Bank Branches' subCaption='(In Asian Countries)' yaxislabel='Branches' xaxislabel='Country'> <set label='Hong Kong' value='235' link='S-Hong Kong,235'/> <set label='Japan' value='123' link='S-Japan,123'/> <set label='Singapore' value='129' link='S-Singapore,129'/> <set label='Malaysia' value='121' link='S-Malayasia,121'/> <set label='Taiwan' value='110' link='S-Taiwan, 110'/> <set label='China' value='90' link='S-China, 90'/> <set label='S. Korea' value='86' link='S-S. Korea, 86'/> </chart> |
||||||||||||||||||||
As you can see above, the initApp() function executes when application initializes. We have added an event listener to trap FCClickEvent event. When this event is raised by clicking those dataplots, which has link value defined with a 'S-' prefix, the function clicked is called. The value that is passed after each 'S-' in the link attribute is passed as the eventListener function parameter. We define clicked function to access the parameter value from e.param and show it in an Alert popup. Now, if you run this code and then click on any data element, the following figure will be displayed: |
||||||||||||||||||||
FCRenderEvent Event | ||||||||||||||||||||
As said earlier, this event is triggered when the chart gets rendered completely. Shown below is the code where we have captured the event using an event listner, which finally throws a message. | ||||||||||||||||||||
<?xml version="1.0" encoding="utf-8"?> import com.events.FCEvent; // Whenever the specific chart gets rendered completely, |
||||||||||||||||||||
As you can see in the above code, like FCClickEvent event, we caught the FCRenderEvent event using an event listener, named rendered. If you run the above code, it gives the following output: | ||||||||||||||||||||
FCLoadEvent Event | ||||||||||||||||||||
As we did in the above two cases, here we will catch the FCLoadEvent event using the event listener function loaded. | ||||||||||||||||||||
<?xml version="1.0" encoding="utf-8"?> import com.events.FCEvent; // Whenever the specific chart gets loaded completely, |
||||||||||||||||||||
The above code when run, gives the following output: | ||||||||||||||||||||
FCErrorEvent Event | ||||||||||||||||||||
This event is triggered when an error occurs while rendering the chart. Like our previous examples, we capture the event using an event listener, and finally throw a message. The MXML file would be as following: |
||||||||||||||||||||
<?xml version="1.0" encoding="utf-8"?>
|
||||||||||||||||||||
As you can see in the code above, we caught the FCErrorEvent event using an event listener, named errorHandler. In the above code the FCFolder parameter is given a wrong value. If you run the above code, you will get the following result: |
||||||||||||||||||||