FlexChart > Working with FlexChart > FlexChart Elements > Annotations > Adding Annotations |
FlexChart enables you to add annotations in an annotation layer, which contains the collection of all annotations in the chart.
To add annotations in FlexChart, follow these steps:
To create an annotation layer in FlexChart, create an instance of the AnnotationLayer class and pass FlexChart as the parameter into it. To add an annotation into the annotation layer, create an instance of the respective annotation class based on its type. Add the annotation instance to the Annotations collection of the annotation layer.
The following code snippet illustrates how to create and add the Rectangle annotation to Annotation Layer in FlexChart.
' create an instance of AnnotationLayer and pass FlexChart as the parameter Dim annotationLayer As New C1.Win.Chart.Annotation.AnnotationLayer(FlexChart1) ' create an instance of the Rectange annotation Dim rect As New C1.Win.Chart.Annotation.Rectangle("Maximum Tax Revenue" & vbLf & "2013" & vbLf & "45000") ' add the annotation to the Annotations collection of the annotation layer annotationLayer.Annotations.Add(rect)
// create an instance of AnnotationLayer and pass FlexChart as the parameter C1.Win.Chart.Annotation.AnnotationLayer annotationLayer = new C1.Win.Chart.Annotation.AnnotationLayer(flexChart1); // create an instance of the Rectange annotation C1.Win.Chart.Annotation.Rectangle rect = new C1.Win.Chart.Annotation.Rectangle("Maximum Tax Revenue\n2013\n45000"); // add the annotation to the Annotations collection of the annotation layer annotationLayer.Annotations.Add(rect);