Chart Title in Windows Forms Chart
26 Apr 20213 minutes to read
Default Title
EssentialChart’s Title property lets you edit the default title for a chart. We can set font style for the title using Title.Font property. The default value is Verdana, 14, Regular.
//Default title
chartControl1.Title.Text = "Essential Chart";
this.chartControl1.Title.Font = new System.Drawing.Font("Candara", 9F, System.Drawing.FontStyle.Bold);
'Default title
chartControl1.Title.Text = "Essential Chart"
chartControl1.Title.Font = New System.Drawing.Font("Candara", 9F, System.Drawing.FontStyle.Bold)
The above default chart title is simply the first in the list of titles that can be specified for the Chart.
Multiple Titles
- Multiple custom Chart Titles can be added to Chart.Titles Collection.
- Supports numerous docking styles (Floating, Left, Right, Bottom or Top) for each title.
- Each of the custom Titles can be aligned to any position as required.
Titles Positioning
Below listed properties will help you to modify the positioning of the Chart Title.
ChartTitle Property | Description |
---|---|
Specifies the position relative to the chart at which to render the chart title panel.
|
|
|
When docked to a side, this property specifies how the title panel should be aligned with respect to the chart boundaries.
|
|
Specifies the docking behavior of the title.
|
Title Look and Feel
There are several appearance options that can be applied on the ChartTitle instance as illustrated in this ChartTitle Collection Editor.
In code, you can add more titles to this list as follows.
//Default title (the first entry in the Titles list)
chartControl1.Title.Text = "Essential Chart";
// Add the title to the Chart control's Titles collection.
ChartTitle title = new Syncfusion.Windows.Forms.Chart.ChartTitle();
title.Text = "Custom Chart Title";
this.chartControl1.Titles.Add(title);
'Default title (the first entry in the Titles list)
chartControl1.Title.Text = "Essential Chart"
' Add the title to the Chart control's Titles collection.
Dim title As New Syncfusion.Windows.Forms.Chart.ChartTitle
title.Text = "Custom Chart Title"
Me.ChartControl1.Titles.Add(title)
Multiline Chart Title
You can now wrap the Chart titles and display them as multiline text. Set multiline title text in ChartTitle.Text property through designer as follows. Press ENTER key to begin a new line. Press CTRL+ENTER to set the text entered.