ChartArea and Chart might contain a collection of titles which is represented by the Titles collection. Each separate title is represented by a Title object that provides some properties declaring its appearance.
Setting a Text
Use the Text property to get or set the text of the title.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Setting a Color
Use the Color property to get or set the color of the title text. The default color is Color.Black.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=12
Setting a Font
Use the Font property to get or set the font of the title text. The default font is the container's font.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Setting a Text Angle
Use the FontAngle property to get or set the angle of the title text. The default value is zero.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Setting a Position
You can choose the type of the title position by setting the PositionType property. The default value is TitlePositionType.Top.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Setting an Alignment
You can control the text alignment using the Alignment property. The default value is Center.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Setting a Spacing
You can control horizontal or vertical spacing between titles using the HorizontalSpace and VerticalSpace properties, respectively. The units are pixels. The default value is zero.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Code Sample
[C#]
Title title = new Title();
// Setting text
title.Text = "I'm a pretty title";
// Setting color
title.Color = Color.Cyan;
// Setting font
title.Font = new Font("Verdana", 12);
// Setting position
title.PositionType = TitlePositionType.Bottom;
// Setting alignment
title.Alignment = StringAlignment.Far;
// Adding to collection of titles
chartArea.Titles.Add(title);
[VB .NET]
Dim title As Title = New Title()
' Setting text
title.Text = "I'm a pretty title"
' Setting color
title.Color = Color.Cyan
' Setting font
title.Font = New Font("Verdana", 12)
' Setting position
title.PositionType = TitlePositionType.Bottom
' Setting alignment
title.Alignment = StringAlignment.Far
' Adding to collection of titles
chartArea.Titles.Add(title)