ComponentOne FlexChart for WinForms
Shape Annotations
FlexChart > Working with FlexChart > FlexChart Elements > Annotations > Types of Annotations > Shape Annotations

Shapes are beneficial for drawing the user’s attention at specific areas where important data is highlighted.

FlexChart offers six shape annotations, as follows:

The following image shows the Line annotation highlighting the maximum customs duty and fees in the year, 2016.

To create any of these specific shapes, create an instance of the shape annotation’s class. Set the dimensions of the shape by using the dimension properties from the corresponding class. For example, to create a line annotation, create an instance of the Line class. Specify the length of the line annotation or rotate it by setting the Start and the End properties of the Line class.

For any shape annotation, specify the text by setting the Content property of the Shape class, the base class for all shape annotations. In addition, other shapes like triangles and arrows can be created using the Polygon annotation in FlexChart.

The following code uses customs tax data on importation of goods for representing its increment or decrement for the year, 2016. The code shows how to add, position, and customize the Line annotation in FlexChart.

' create an instance of the Line annotation
Dim line As New C1.Win.Chart.Annotation.Line()

' specify the line content 
line.Content = "Maximum Customs Duty and Fees: 31000"

' specify the start and end points of the line
line.Start = New PointF(0, 31000)
line.[End] = New PointF(12, 31000)

' specify the line attachment
line.Attachment = C1.Chart.Annotation.AnnotationAttachment.DataCoordinate

' set the line position
line.Position = C1.Chart.Annotation.AnnotationPosition.Top

' customize the line style and content style
line.Style.StrokeColor = Color.DarkTurquoise
line.Style.StrokeWidth = 3
line.ContentStyle.StrokeColor = Color.Black
line.ContentStyle.Font = New System.Drawing.Font(FontFamily.GenericSansSerif, 9, FontStyle.Regular)

' add the line to the Annotations collection of the annotation layer
annotationLayer.Annotations.Add(line)
// create an instance of the Line annotation
C1.Win.Chart.Annotation.Line line = new C1.Win.Chart.Annotation.Line();
            
// specify the line content 
line.Content = "Maximum Customs Duty and Fees: 31000";

// specify the start and end points of the line
line.Start = new PointF(0,31000);
line.End = new PointF(12,31000);

// specify the line attachment
line.Attachment = C1.Chart.Annotation.AnnotationAttachment.DataCoordinate;

// set the line position
line.Position = C1.Chart.Annotation.AnnotationPosition.Top;

// customize the line style and content style
line.Style.StrokeColor = Color.DarkTurquoise;
line.Style.StrokeWidth = 3;
line.ContentStyle.StrokeColor = Color.Black;
line.ContentStyle.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 9, FontStyle.Regular);

// add the line to the Annotations collection of the annotation layer
annotationLayer.Annotations.Add(line);