windowsforms-120591-controls-and-libraries-chart-control-panes-pane-title.md
You can show a title above the pane to distinguish between multiple panes. End users can use the expand button next to the title to hide or show panes.
This document explains how to:
Each pane can have one title. To display the title, set its Visibility property to True. The title is shown with a button that allows you to collapse and expand a pane if the XYDiagramPaneBase.RuntimeCollapse (or XYDiagram2D.RuntimePaneCollapse) option is enabled. If an end user collapses a pane, other panes’ sizes are recalculated to occupy all the available space. Set RuntimeCollapse to false to hide the title expand button and prevent end users from collapsing panes.
To specify the title’s content, use the Text property. Its default value is the pane’s Name property value.
Note
The Chart Control can hide its elements if there is insufficient space to display them. Elements are hidden in the following order:
To make the Chart Control always display its elements, disable the ChartControl.AutoLayout property.
You can configure a pane title’s options in the Properties window:
The following code specifies a pane’s title text and visibility:
XYDiagramPane pane = diagram.Panes["Temperature Pane"];
if(pane != null) {
pane.Title.Text = "Temperature";
pane.Title.Visibility = DefaultBoolean.True;
}
Dim pane As XYDiagramPane = diagram.Panes("Temperature Pane")
If (Not (pane) Is Nothing) Then
pane.Title.Text = "Temperature"
pane.Title.Visibility = DefaultBoolean.True
End If
The code above uses the following API members:
| Member | Description |
|---|---|
| XYDiagramPaneBase.Title | Returns the pane title settings. |
| Title.Text | Gets or sets title content. |
| PaneTitle.Visibility | Specifies whether the title is visible. |
You can align a pane title to the pane’s top edge and configure indents between the title and other chart elements.
The following code shows how to customize the alignment and margins:
pane.Title.Alignment = StringAlignment.Far;
pane.Title.Margins.Left = 0;
pane.Title.Margins.Top = 10;
pane.Title.Margins.Right = 0;
pane.Title.Margins.Bottom = 10;
pane.Title.Alignment = StringAlignment.Far
pane.Title.Margins.Left = 0
pane.Title.Margins.Top = 10
pane.Title.Margins.Right = 0
pane.Title.Margins.Bottom = 10
Use the following API members to align pane titles:
| Member | Description |
|---|---|
| PaneTitle.DXAlignment | Specifies the title’s alignment. |
| PaneTitle.Margins | Specifies the title’s outer indents. |
| RectangleIndents.Left | Gets or sets the title’s left margin. |
| RectangleIndents.Top | Gets or sets the title’s upper margin. |
| RectangleIndents.Right | Specifies the title’s right margin. |
| RectangleIndents.Bottom | Gets or sets the title’s lower margin. |
You can use the TitleBase.DXFont property to configure font parameters, and the TitleBase.TextColor property to change the title’s color.
The following sample demonstrates how to change a title’s font and color:
using System.Drawing;
using DevExpress.Drawing;
// ...
pane.Title.DXFont = new DXFont("Tahoma", 14, DXFontStyle.Bold);
pane.Title.TextColor = Color.Gray;
Imports System.Drawing
Imports DevExpress.Drawing
' ...
pane.Title.DXFont = New DXFont("Tahoma", 14, DXFontStyle.Bold)
pane.Title.TextColor = Color.Gray
The code above uses the following properties:
| Property | Description |
|---|---|
| TitleBase.DXFont | Specifies the title’s font. |
| TitleBase.TextColor | Defines the title’s text color. |