In FlexChart, positioning annotations includes two mechanisms (not necessarily in the same order), as follows:
- Positioning annotations relative to the chart.
- Positioning annotations relative to the data points.
Positioning Annotations Relative to the Chart
Positioning annotations relative to the chart includes specifying the attachment and the location of the annotations in the chart.
FlexChart provides four ways of attaching annotations, as follows:
- Absolute: This attachment indicates that the annotation is fixed and cannot move, irrespective of the resizing of the application. To set the absolute attachment, set the Attachment property to Absolute from the AnnotationAttachment enum. To set the location of the annotation in the absolute attachment mode, set the annotation’s coordinates in pixels.
- DataCoordinate: This attachment indicates that the annotation is attached to a specific data point. To set this attachment, set the Attachment property to DataCoordinate from the AnnotationAttachment enum. To set the annotation’s location, specify the annotation’s data coordinates by setting the Location property.
- DataIndex: This attachment indicates that the annotation is attached to the series as per the series index and to the point as per the point index. To set this attachment, set the Attachment property to DataIndex from the AnnotationAttachment enum. To specify the annotation’s location, set the SeriesIndex and the PointIndex properties.
- Relative: This attachment indicates that the annotation retains its location and dimensions relative to the chart. To set this attachment, set the Attachment property to Relative from the AnnotationAttachment enum. Specify the annotation’s location using the Location property in terms of relative position inside the chart where (0, 0) is the top left corner and (1, 1) is the bottom right corner.
Positioning Annotations Relative to the Data Points
Specify the position of annotations with respect to the data points by setting the Position property from the AnnotationPosition enum.
The following image displays the Rectangle annotation highlighting the maximum tax revenue in the year, 2013.
![](images/PositioningAnnotations.png)
The following code compares tax revenue data of nine consecutive years to display the maximum tax revenue. The code shows how to specify the attachment, location, and position of the Rectangle annotation to Annotation Layer in FlexChart.