Annotations > Introduction |
||||
Annotations let you create your own custom objects (shapes, images, text etc.) in the charts. You can create various shapes like polygons, rectangles, circles, arcs etc, render annotation text at required positions and load external GIF/JPEG/PNG images or other Flash movies in the chart itself. The main features of annotations are:
Shown below are a few samples where we've applied annotation over charts: |
||||
|
||||
There are a lot of cosmetic and functional properties that you can define for each annotation and customize it entirely the way you want. Let us now take a look at the general XML structure required to create an annotation. | ||||
<chart bgColor='333333' bgAlpha='100' gaugeStartAngle='90' gaugeEndAngle='-270' lowerLimit='0' upperLimit='12' lowerLimitDisplay=' ' upperLimitDisplay='12' majorTMNumber='12' majorTMThickness='3' majorTMColor='FFFFFF' majorTMHeight='7' minorTMNumber='4' minorTMColor='FFFFFF' minorTMHeight='4' placeValuesInside='1' tickValueStep='3' tickValueDistance='20' gaugeOuterRadius='95' gaugeInnerRadius='95' showShadow='0' pivotRadius='6' pivotFillColor='FFFFFF' annRenderDelay='0'> <!--Circle behind the pivot--> <application> |
||||
The <annotations> element signifies the start of annotations in the XML data. All the code to generate the annotations is enclosed within <annotations> and </annotations>. Each annotation has to be placed within one annotation group or the other. An annotation group is created using the <annotationGroup> element. Each annotation group necessarily has to have an ID, and that too a unique one. This ID comes into use when you are using STYLEs, Alert manager or JavaScript API. Individual annotation objects can be placed within the annotation group using the <annotation> element. The <annotation> element has some essential properties like type, x, y etc. and lots of other cosmetic and functional properties. Let us take a look at each of these elements in greater detail now. |
||||
<annotationGroup> element | ||||
<annotationGroup> elements are used to consolidate a number of annotations under one group. For example, say that you've created your company logo using custom objects, and you want the logo to be present on all the charts (on the top left corner). Now, your company logo consists of two polygons, one rectangle, three lines and two textboxes. So, you can group all of these individual annotations under an <annotationGroup>, so that whenever you need to re-position the logo on the chart or scale it, you can directly assign the new position to the annotation group itself, instead of applying the same to all the annotations within. Also, if you need to show an annotation below the chart, you can set the layering depth of the same using annotation group only. For example, you've created a textured background using annotations and now you want all your charts to have that textured background. However, by default if you just place it within an annotation group, the background will appear over the chart. With the showBelow property of the annotationGroup element, you can configure to show the entire annotation group below the chart. In an annotation group, the annotation which has been defined first will appear at the bottom-most within that respective group and the one which has been defined last will appear at the top-most. If the chart contains more than one annotation group, then the stacking order of various annotation groups is also determined similarly. Let's study the attributes supported by <annotationGroup> element in detail:
You can have as many number of annotation groups as you want - however, it is wise to group related annotations under one group, rather than creating groups at random. Now that you're clear with annotation groups, let's have a look at the main element of annotations - the <annotation> element. |
||||
<annotation> element | ||||
Each <annotation> element helps you specify an annotation for the chart. And for each annotation, there are a lot of properties which you can define using the attributes of this element. The most important attribute of this element is type, which helps you define what kind of annotation needs to be drawn. Example: The type attribute of <annotation> element can take the following values:
Pretty self explanatory - each of these type helps you create that shape on the chart. Every annotation needs a few other parameters to function properly. Like the rectangle needs to know where to start from and where to end. Also, it needs the cosmetic properties like border color, fill color etc. It's not necessary to define all the properties, as FusionWidgets will take the default value for all those attributes whose value you've not specified. Let's now delve into the attributes for each annotation type that can help you control the annotation better. |
||||