Back to Devexpress

ChartTitleCollection.Add(ChartTitle) Method

corelibraries-devexpress-dot-xtracharts-dot-charttitlecollection-dot-add-x28-devexpress-dot-xtracharts-dot-charttitle-x29.md

latest6.3 KB
Original Source

ChartTitleCollection.Add(ChartTitle) Method

Appends the specified ChartTitle object to the current collection.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public int Add(
    ChartTitle title
)
vb
Public Function Add(
    title As ChartTitle
) As Integer

Parameters

NameTypeDescription
titleChartTitle

A ChartTitle object to append to the collection.

|

Returns

TypeDescription
Int32

An integer value indicating the position at which the new element was inserted.

|

Remarks

This method adds a ChartTitle object to the end of the collection.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(ChartTitle) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-charts-create-model-for-custom-chart-element/CS/CustomChartElementModel/Form1.cs#L125

csharp
chartTitle.Text = "Temperature (°F)";
chart.Titles.Add(chartTitle);

winforms-charts-create-real-time-chart/CS/RealTimeChartUpdates/Form1.cs#L14

csharp
void Form1_Load(object sender, EventArgs e) {
    chartControl1.Titles.Add(new ChartTitle { Text = "Real-Time Charting" });

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/CS/RealTimeChartUpdates/Form1.cs#L23

csharp
dataAcquisitionThread.Start();
chartControl1.Titles.Add(new ChartTitle { Text = "Real-Time Charting" });

winforms-charts-create-stacked-bar-chart/CS/Series_StackedBarChart/Form1.cs#L38

csharp
// Add a chart title:
chart.Titles.Add(new ChartTitle { Text = "Sales by Products" });

winforms-chart-create-a-3d-pie-chart/CS/3DPieChart/Form1.cs#L47

csharp
chartTitle1.Text = "3D Pie Chart";
PieChart3D.Titles.Add(chartTitle1);
PieChart3D.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;

winforms-charts-create-model-for-custom-chart-element/VB/CustomChartElementModel/Form1.vb#L184

vb
chartTitle.Text = "Temperature (°F)"
chart.Titles.Add(chartTitle)
Dim diagram As XYDiagram = TryCast(chart.Diagram, XYDiagram)

winforms-charts-create-real-time-chart/VB/RealTimeChartUpdates/Form1.vb#L21

vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    chartControl1.Titles.Add(New ChartTitle With {.Text = "Real-Time Charting"})
    Dim series As Series = New Series()

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/VB/RealTimeChartUpdates/Form1.vb#L36

vb
dataAcquisitionThread.Start()
chartControl1.Titles.Add(New ChartTitle With {.Text = "Real-Time Charting"})
Dim series As Series = New Series()

winforms-charts-create-stacked-bar-chart/VB/Series_StackedBarChart/Form1.vb#L36

vb
' Add a chart title:
chart.Titles.Add(New ChartTitle With {.Text = "Sales by Products"})
' Specify legend settings:

winforms-chart-create-a-3d-pie-chart/VB/3DPieChart/Form1.vb#L43

vb
chartTitle1.Text = "3D Pie Chart"
PieChart3D.Titles.Add(chartTitle1)
PieChart3D.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False

See Also

AddRange(ChartTitle[])

Remove(ChartTitle)

ChartTitleCollection Class

ChartTitleCollection Members

DevExpress.XtraCharts Namespace