corelibraries-devexpress-dot-xtracharts-dot-dockabletitle.md
Gets or sets a value specifying the parent control edges, to which a title is docked.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public ChartTitleDockStyle Dock { get; set; }
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property Dock As ChartTitleDockStyle
| Type | Description |
|---|---|
| ChartTitleDockStyle |
A ChartTitleDockStyle enumeration value.
|
Available values:
| Name | Description |
|---|---|
| Top |
A title is positioned at the top of the chart control.
| | Bottom |
A title is positioned at the bottom of the chart control.
| | Left |
A title is positioned to the left of the chart control.
| | Right |
A title is positioned to the right of the chart control.
|
The position of a title within its parent control is specified by the Dock and AlignedTitle.Alignment properties. While the Dock property specifies the parent control’s edge (left, right, top or bottom) which a title will be allocated to, the AlignedTitle.Alignment property controls how the title is aligned (near, far, at the center) along this edge.
The images in the following table illustrate how a chart title can be docked to different edges of a chart control (note that the AlignedTitle.Alignment property is set to the default Center value).
| Top | Bottom |
|---|---|
| Left | Right |
For more information, refer to Chart Titles.
This example demonstrates how chart titles can be accessed and customized at runtime.
// 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});
' 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 snippet (auto-collected from DevExpress Examples) contains a reference to the Dock 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.
winforms-chart-create-and-customize-chart-titles/CS/Form1.cs#L30
// Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top;
chartTitle2.Dock = ChartTitleDockStyle.Bottom;
winforms-chart-create-and-customize-chart-titles/VB/Form1.vb#L29
' Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top
chartTitle2.Dock = ChartTitleDockStyle.Bottom
See Also