Articles in this section
Category / Section

How to manipulate Chart Title?

4 mins read

 

Chart Title can be customized using Properties window at design time and also programmatically at run time. Through Properties window we can modify its properties using Titles Property under ChartControl object.

The Title can be customized programmatically. The Text, Background and Foreground colors are also be modified. The following code snippet illustrates this. We can also enable or disable chart title.

C#

// Specifying Chart Title

this.chartControl1.Title.Text = "My Chart";

this.chartControl1.Title.Alignment = ChartAlignment.Center;

this.chartControl1.Title.Position = ChartDock.Bottom;

this.chartControl1.Title.Enabled = true;

this.chartControl1.Title.Visible = true;

// Specifying Color

this.chartControl1.Title.BackColor = Color.Lavender;

this.chartControl1.Title.ForeColor = Color.Green;

this.chartControl1.Title.Font = new Font("Arial", 14.0f);

VB

' Specifying Chart Title

Me.ChartControl1.Title.Text = "My Chart"

Me.ChartControl1.Title.Alignment = ChartAlignment.Center

Me.ChartControl1.Title.Position = ChartDock.Bottom

Me.ChartControl1.Title.Enabled = True

Me.ChartControl1.Title.Visible = True

' Specifying Color

Me.ChartControl1.Title.BackColor = Color.Lavender

Me.ChartControl1.Title.ForeColor = Color.Green

Me.ChartControl1.Title.Font = new Font("Arial", 14.0f)

To display the border of the Title ShowBorder property is used. Border's Color, Style,Width can also be modified.

C#

// Specifying Border Properties

this.chartControl1.Title.ShowBorder = true;

this.chartControl1.Title.Border.ForeColor = Color.Red;

this.chartControl1.Title.Border.DashStyle = DashStyle.Dot;

this.chartControl1.Title.Border.Width = 2f;

VB

' Specifying Border Properties

Me.ChartControl1.Title.ShowBorder = true

Me.ChartControl1.Title.Border.ForeColor = Color.Red

Me.ChartControl1.Title.Border.DashStyle = DashStyle.Dot

Me.ChartControl1.Title.Border.Width = 2f

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied