We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to manipulate Chart Title?

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
65 04/30/2011 07/10/2014 Windows Forms Chart
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.