Example E1375
Visible to All Users

Chart for WinForms - How to Create and Customize Chart Titles

This example demonstrates how to create and customize chart titles at runtime.

Chart

Files to Review

Form1.cs (VB: Form1.vb)

Documentation

Chart Titles

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Form1.cs(vb)
C#
using System; using System.Drawing; using System.Windows.Forms; using DevExpress.Drawing; using DevExpress.XtraCharts; namespace WindowsApplication25 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Create chart titles. ChartTitle chartTitle1 = new ChartTitle(); ChartTitle chartTitle2 = new ChartTitle(); // Define the text for the titles. chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>."; chartTitle2.Text = "The capability to word-wrap is available for chart titles."; chartTitle2.WordWrap = true; chartTitle2.MaxLineCount = 2; // Define the alignment of the titles. chartTitle1.Alignment = StringAlignment.Center; chartTitle2.Alignment = StringAlignment.Near; // Place the titles where it's required. chartTitle1.Dock = ChartTitleDockStyle.Top; chartTitle2.Dock = ChartTitleDockStyle.Bottom; // Customize a title's appearance. chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; chartTitle1.DXFont = new DXFont("Tahoma", 14, DXFontStyle.Bold); chartTitle1.TextColor = Color.Red; chartTitle1.Indent = 10; // Add the titles to the chart. chartControl1.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2}); } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.