|
Essential Chart supports giving titles to various objects of the Chart Control. Title can be given to Chart, Series, Axes and Legend. These titles can also be cutomizied. We can add border to the ChartTitle by setting ShowBorder to true. C# // Specifying Chart Title this.chartControl1.Title.Text = "My Chart"; this.chartControl1.Title.Alignment = ChartAlignment.Center; this.chartControl1.Title.ForeColor = Color.MidnightBlue; this.chartControl1.Title.Font = new Font("Arial", 14.0f); // Specifying Border Properties this.chartControl1.Title.ShowBorder = true; this.chartControl1.Title.Border.ForeColor = Color.DarkBlue; this.chartControl1.Title.Border.Width = 2; this.chartControl1.Title.Border.DashStyle = DashStyle.DashDotDot; VB ' Specifying Chart Title Me.ChartControl1.Title.Text = "My Chart" Me.ChartControl1.Title.Alignment = ChartAlignment.Center Me.ChartControl1.Title.ForeColor = Color.MidnightBlue Me.ChartControl1.Title.Font = New Font("Arial", 14.0f) ' Specifying Border Properties Me.ChartControl1.Title.ShowBorder = True Me.ChartControl1.Title.Border.ForeColor = Color.DarkBlue Me.ChartControl1.Title.Border.Width = 2 Me.ChartControl1.Title.Border.DashStyle = DashStyle.DashDotDot The Series Text color can be changed using TextColor property. TextOrientation property enables us to specify the alignment of the text. C# // Customizing Series Text this.chartControl1.Series[0].Style.DisplayText = true; this.chartControl1.Series[0].Style.TextOrientation = ChartTextOrientation.Up; this.chartControl1.Series[0].Style.Text = "S1"; this.chartControl1.Series[0].Style.TextColor = Color.Magenta; this.chartControl1.Series[0].Style.TextOffset = 5f; VB ' Customizing Series Text Me.ChartControl1.Series(0).Style.DisplayText = True Me.ChartControl1.Series(0).Style.TextOrientation = ChartTextOrientation.Up Me.ChartControl1.Series(0).Style.Text = "S1" Me.ChartControl1.Series(0).Style.TextColor = Color.Magenta Me.ChartControl1.Series(0).Style.TextOffset = 5.0F The Title property enables us to specify the axes title. The TitleAlignment property enables us to specify the alignment of the title. C# this.chartControl1.PrimaryXAxis.Title = "Year"; this.chartControl1.PrimaryXAxis.TitleAlignment = StringAlignment.Far; this.chartControl1.PrimaryXAxis.ForeColor = Color.Blue; this.chartControl1.PrimaryYAxis.Title = "Production"; this.chartControl1.PrimaryYAxis.TitleAlignment = StringAlignment.Center; this.chartControl1.PrimaryYAxis.ForeColor = Color.Blue; VB Me.ChartControl1.PrimaryXAxis.Title = "Year" Me.ChartControl1.PrimaryXAxis.TitleAlignment = StringAlignment.Far Me.ChartControl1.PrimaryXAxis.ForeColor = Color.Blue Me.ChartControl1.PrimaryYAxis.Title = "Production" Me.ChartControl1.PrimaryYAxis.TitleAlignment = StringAlignment.Center Me.ChartControl1.PrimaryYAxis.ForeColor = Color.Blue |