FusionCharts for Flex > FusionWidgets and XML > Annotations > Flex API

The annotations can be controlled by Flex using the following methods:

 
Method Name Parameter Description
showAnnotation(strGroupID:String):void strGroupID:String Shows an annotation with the specified group ID.
hideAnnotation(strGroupID:String):void strGroupID:String Hides an annotation with the specified group ID.

 

Using these methods

To use any of the methods above, we first need to create a widget in Flex and assign an id to it. In the following code we create a widget with id '"fw".

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:components="com.fusionwidgets.components.*">

   <components:FusionWidgets id="fw" x="10" y="10" FCDataURL="Data.xml" width="400" height="290"/>

</s:Application>

After this we will be adding controls to show or hide the annotations. For this purpose we will be adding two buttons, as in the following code.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:components="com.fusionwidgets.components.*">

   <components:FusionWidgets id="fw" x="10" y="10" FCDataURL="Data.xml" width="400" height="290"/>

   <!-- Shows the annotation group 'GRPRED' upon click action -->
   <s:Button label="Show Annotation" click="fw.FCShowAnnotation('GRPRED')" />

   <!-- Hides the annotation group 'GRPRED' upon click action -->
   <s:Button label="Hide Annotation" click="fw.FCHideAnnotation('GRPRED')" />

</s:Application>

In the above code we call upon the FCShowAnnotation and FCHideAnnotation through the click event of two buttons. These methods are used to show or hide the annotation group with id "GRPRED".