ActiveReports for .NET 3 Online Help Request technical support
Annotations
User Guide > Concepts > Charts > Chart Appearance > Chart Control Items > Annotations

Glossary Item Box

The Chart control offers a built-in annotation tool to allow you to include floating text bars or images in your charts or call attention to specific items or values in your charts using the line and text bar controls included in the Annotation Collection Editor.

 

The following properties are important when setting up annotations for your chart:

 

The following code demonstrates creating annotation lines and text bars, setting their properties, and adding them to the series annotations collection at run time. The results are shown in the screenshot above. 

' Visual Basic

' create the annotation lines and text bars
Dim aLine1 As New DataDynamics.ActiveReports.Chart.Annotations.AnnotationLine
Dim aLine2 As New DataDynamics.ActiveReports.Chart.Annotations.AnnotationLine
Dim aText1 As New DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar
Dim aText2 As New DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar

' set the properties for each line and text bar
With aLine1
        .EndPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 30.0F)
        .Line = New DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color _
        	.Red, 2)
        .StartPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 15.0F)
End With
With aLine2
        .EndPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(4.6F, 47.0F)
        .Line = New DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color _
        	.Red, 2)
        .StartPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(3.6F, 45.0F)
End With
With aText1
        .AnchorPlacement = DataDynamics.ActiveReports.Chart.Annotations _
        	.AnchorPlacementType.Bottom
        .AnchorPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 31.0F)
        .Height = 25.0F
        .Line = New DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color _
        	.Red, 2)
        .Text = "Min Value"
        .Width = 100.0F
End With
With aText2
        .AnchorPlacement = DataDynamics.ActiveReports.Chart.Annotations _
        	.AnchorPlacementType.Left
        .AnchorPoint = New DataDynamics.ActiveReports.Chart.Graphics.Point2d(4.7F, 47.0F)
        .Height = 25.0F
        .Line = New DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color _
        	.Red, 2)
        .Text = "Max Value"
        .Width = 100.0F
End With

' add the annotation lines and text bars to the annotations collection for the series
Me.ChartControl1.Series(0).Annotations.AddRange(New DataDynamics.ActiveReports.Chart _
	.Annotations.Annotation() {aLine1, aLine2, aText1, aText2})

 

// C#

// create the annotation lines and text bars
DataDynamics.ActiveReports.Chart.Annotations.AnnotationLine aLine1 = new 
	DataDynamics.SharpGraph.Windows.Annotations.AnnotationLine();
DataDynamics.ActiveReports.Chart.Annotations.AnnotationLine aLine2 = new 
	DataDynamics.SharpGraph.Windows.Annotations.AnnotationLine();
DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar aText1 = new 
	DataDynamics.SharpGraph.Windows.Annotations.AnnotationTextBar();
DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar aText2 = new 
	DataDynamics.SharpGraph.Windows.Annotations.AnnotationTextBar();

// set the properties for each line and text bar
aLine1.EndPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 30F);
aLine1.Line = new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red, 
	2);
aLine1.StartPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 15F);
aLine2.EndPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(4.6F, 47F);
aLine2.Line = new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red, 
	2);
aLine2.StartPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(3.6F, 45F);
aText1.AnchorPlacement = DataDynamics.ActiveReports.Chart.Annotations.AnchorPlacementType
	.Bottom;
aText1.AnchorPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F, 31F);
aText1.Height = 25F;
aText1.Line = new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red, 
	2);
aText1.Text = "Min Value";
aText1.Width = 100F;
aText2.AnchorPlacement = DataDynamics.ActiveReports.Chart.Annotations.AnchorPlacementType
	.Left;
aText2.AnchorPoint = new DataDynamics.ActiveReports.Chart.Graphics.Point2d(4.7F, 47F);
aText2.Height = 25F;
aText2.Line = new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red, 
	2);
aText2.Text = "Max Value";
aText2.Width = 100F;

// add the annotation lines and text bars to the annotations collection for the series
this.chartControl1.Series[0].Annotations.AddRange(new DataDynamics.ActiveReports.Chart
	.Annotations.Annotation[] {aLine1, aLine2, aText1, aText2});

 

©2009. All Rights Reserved.