Chart supports several types of titles. The Titles
collection can store an unlimited number of
titles that can be placed anywhere within a chart. There are also axis
and strip line titles.
This overview refers to the Title objects stored in the chart's Titles collection as "chart titles". Chart titles are more robust than the strip line and axis titles.
The Titles collection of the root Chart object can store an unlimited number of Title objects.
Appearance Properties and Styles
Title objects, like many other Chart elements, support a wide variety of appearances including the following:
Gradient colors, with numerous styles available. Applicable to both legends and legend items. Hatching,with numerous patterns available. Background images. Transparency, set using a color's alpha value. Shadows.There are also several styles available (e.g. emboss, frame, etc.), which can be set using the Title.Style property (see figure below):
Positioning, Docking and Alignment
A Title object may be docked to a chart area or the chart picture, allowing for easy positioning of the title. When docking to a chart area the Title may be docked inside or outside of the chart area using the IsDockedInsideChartArea boolean property.
The docking mechanism allows for a docking offset via the DockingOffset property. This is a positive or negative integer value, in pixels, which determines how much the title region is shifted from the default docking position.
The Title object also contains an Alignment property, which defines where in the title region the text should be drawn.
If a Title object has been configured with explicit Position values, the Docking and Alignment properties are ignored.
Automatic Sizing of Title Text
Title text by default is automatically sized to fit the entire Title object's bounding rectangle. Automatic fitting of text occurs when the Position property of the Title object is set to true.
Multi-Line Titles
The Chart control supports multi-line titles. To insert a line break into a title, use "\n" characters. See the figure above for an example of a multi-line title.
Titles in the Axis and StripLine objects are similar to chart titles, but they do have the following differences:
Titles in the Axis and StripLine objects do not have all of the appearance properties of chart titles. Titles in the Axis and StripLine objects are docked inside their owning objects; and docking is not customizable. Title text is always automatically sized to fit the entire Axis or StripLine object.Multi-Line Titles
A line break can be inserted into a title via the "\n" characters. See the figure below for an example.