Back to Devexpress

Title.Text Property

corelibraries-devexpress-dot-xtracharts-dot-title.md

latest8.0 KB
Original Source

Title.Text Property

Gets or sets the title’s text.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XRLocalizable(true)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public string Text { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
<XRLocalizable(True)>
Public Property Text As String

Property Value

TypeDescription
String

A String value which represents the title’s text.

|

Remarks

You can use HTML tags to format the Text. For detailed information see HTML Text Formatting

Example

This example demonstrates how chart titles can be accessed and customized at runtime.

csharp
// Create chart titles.
ChartTitle chartTitle1 = new ChartTitle();
ChartTitle chartTitle2 = new ChartTitle();

// Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>.";
chartTitle2.Text = "The capability to word-wrap is available for chart titles.";

chartTitle2.WordWrap = true;
chartTitle2.MaxLineCount = 2;

// Define the alignment of the titles.
chartTitle1.Alignment = StringAlignment.Center;
chartTitle2.Alignment = StringAlignment.Near;

// Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top;
chartTitle2.Dock = ChartTitleDockStyle.Bottom;

// Customize a title's appearance.
chartTitle1.Antialiasing = true;
chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold);
chartTitle1.TextColor = Color.Red;
chartTitle1.Indent = 10;

// Add the titles to the chart.
chartControl1.Titles.AddRange(new ChartTitle[] {
chartTitle1,
chartTitle2});
vb
' Create chart titles.
Dim chartTitle1 As New ChartTitle()
Dim chartTitle2 As New ChartTitle()

' Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>."
chartTitle2.Text = "The capability to word-wrap is available for chart titles."

chartTitle2.WordWrap = True
chartTitle2.MaxLineCount = 2

' Define the alignment of the titles.
chartTitle1.Alignment = StringAlignment.Center
chartTitle2.Alignment = StringAlignment.Near

' Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top
chartTitle2.Dock = ChartTitleDockStyle.Bottom

' Customize a title's appearance.
chartTitle1.Antialiasing = True
chartTitle1.Font = New Font("Tahoma", 14, FontStyle.Bold)
chartTitle1.TextColor = Color.Red
chartTitle1.Indent = 10

' Add the titles to the chart.
chartControl1.Titles.AddRange(New ChartTitle() { chartTitle1, chartTitle2})

The following code snippets (auto-collected from DevExpress Examples) contain references to the Text property.

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.

dashboard-constant-lines/CS/ConstantLineExtension.Win/ConstantLineModule.cs#L78

csharp
line.Color = customConstantLine.Color;
line.Title.Text = customConstantLine.LabelText;
line.LineStyle.DashStyle = DashStyle.Dash;

winforms-heatmap-bind-to-data-source/CS/Form1.cs#L63

csharp
heatmap.AxisX.Title.Text = "Region";
heatmap.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;

winforms-chart-create-and-customize-an-axis-title/CS/AxisTitle/Form1.cs#L36

csharp
diagram.AxisX.Title.Alignment = StringAlignment.Center;
diagram.AxisX.Title.Text = "<i>X-axis</i> <color=violet>Title</color>";
diagram.AxisX.Title.TextColor = Color.Red;

winforms-chart-create-and-customize-chart-titles/CS/Form1.cs#L19

csharp
// Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>.";
chartTitle2.Text = "The capability to word-wrap is available for chart titles.";

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

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

winforms-heatmap-bind-to-data-source/VB/Form1.vb#L41

vb
Me.heatmap.EnableAxisYZooming = True
Me.heatmap.AxisX.Title.Text = "Region"
Me.heatmap.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.[True]

winforms-chart-create-and-customize-an-axis-title/VB/AxisTitle/Form1.vb#L35

vb
diagram.AxisX.Title.Alignment = StringAlignment.Center
diagram.AxisX.Title.Text = "<i>X-axis</i> <color=violet>Title</color>"
diagram.AxisX.Title.TextColor = Color.Red

winforms-chart-create-and-customize-chart-titles/VB/Form1.vb#L21

vb
' Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>."
chartTitle2.Text = "The capability to word-wrap is available for chart titles."

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

vb
Dim chartTitle As ChartTitle = New ChartTitle()
chartTitle.Text = "Temperature (°F)"
chart.Titles.Add(chartTitle)

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/ConstantLineUserValueModule.vb#L105

vb
line.LineStyle.DashStyle = DashStyle.Dash
line.Title.Text = "Value: " & moduleData.Value.ToString()
line.Title.TextColor = line.Color

See Also

Font

TextColor

Title Class

Title Members

DevExpress.XtraCharts Namespace