Titles

Titles give a description about what the chart is about. Titles are displayed on a single line. Therefore, text that does not fit on one line will be truncated. However, you can add multiple Titles to charts, plot areas and the XAxis and the YAxis. There are three different types of titles:

Chart Titles

Charts can have HeaderTitles and FooterTitles. HeaderTitles appear on top of the chart and FooterTitles appear at the bottom of the chart.

The following code shows how to add HeaderTitle and FooterTitle to a chart:

Chart chart = new Chart(0, 0, 300, 200);
Title title1 = new Title("Header Title");
Title title2 = new Title("Footer Title");
chart.HeaderTitles.Add(title1);
chart.FooterTitles.Add(title2);         
Dim MyChart As Chart = New Chart(0, 0, 300, 200)
Dim MyTitle1 As Title = New Title("Header Title")
Dim MyTitle2 As Title = New Title("Footer Title")
MyChart.HeaderTitles.Add(title1)
MyChart.FooterTitles.Add(title2)           

Plot Area Titles

Plot Areas can have TopTitles and BottomTitles. TopTitles appear on top of the Plot Area and BottomTitles appear at the bottom of the Plot Area.

The following code shows how to add TopTitles and BottomTitles to a plot area.

Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.PrimaryPlotArea;
Title title1 = new Title("Top Title");
Title title2 = new Title("Bottom Title");
plotArea.TopTitles.Add(title1);
plotArea.BottomTitles.Add(title2);        
Dim MyChart As Chart = New Chart(0, 0, 300, 200)
Dim MyPlotArea = MyChart.PrimaryPlotArea
Dim MyTitle1 As Title = New Title("Top Title")
Dim MyTitle2 As Title = New Title("Bottom Title")
MyChart1.HeaderTitles.Add(title1)
MyChart1.FooterTitles.Add(title2)   

Axis Titles

Axis titles describe what data on the XAxis and the YAxis represent.

The following code shows how to add Titles to the axes.

Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.PrimaryPlotArea;
Title title1 = new Title("XAxis Title");
Title title2 = new Title("YAxis Title");
plotArea.XAxes.DefaultNumericXAxis.Titles.Add(title1);
plotArea.YAxes.DefaultNumericYAxis.Titles.Add(title2);         
Dim MyChart As Chart = New Chart(0, 0, 300, 200)
Dim MyPlotArea = MyChart.PrimaryPlotArea
Dim MyTitle1 As Title = New Title("XAxis Title")
Dim MyTitle2 As Title = New Title("YAxis Title")
MyPlotArea.XAxes.DefaultNumericXAxis.Titles.Add(MyTitle1)
MyPlotArea.YAxes.DefaultNumericYAxis.Titles.Add(MyTitle2)

In this topic