corelibraries-devexpress-dot-xtracharts-9b604999.md
Defines the common settings of an axis’s title.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public abstract class AxisTitle :
Title,
ITextPropertiesProvider,
IHitTest,
ISupportTextAntialiasing,
ISupportVisibilityControlElement
Public MustInherit Class AxisTitle
Inherits Title
Implements ITextPropertiesProvider,
IHitTest,
ISupportTextAntialiasing,
ISupportVisibilityControlElement
The following members return AxisTitle objects:
The AxisTitle class declares properties that define the common appearance settings of a title which is displayed by a particular axis.
Properties exposed via the AxisTitle class allow you to customize common title attributes, such as:
At the same time the AxisTitle class represents the base class for the AxisTitleX and AxisTitleY classes that respectively define title settings for axes of X and Y types. The properties and methods which are defined by the AxisTitle class specify the base axis title settings and are common to all axis titles. The only difference in axis titles of the AxisTitleX and AxisTitleY types is in the initialization of the Title.Text property’s default value.
For more information, refer to Axis Titles.
This example demonstrates how to access an axis title at runtime.
Cast your diagram object to the required diagram type to access its axes. Then, you can access the Axis2D.Title property.
View Example: How to Create and Customize an Axis Title
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Drawing;
using DevExpress.XtraCharts;
namespace AxisTitle {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
// ...
// Cast the chart's diagram to the XYDiagram type, to access its axes.
XYDiagram diagram = chartControl1.Diagram as XYDiagram;
// Customize the appearance of the X-axis title.
diagram.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisX.Title.Alignment = StringAlignment.Center;
diagram.AxisX.Title.Text = "<i>X-axis</i> <color=violet>Title</color>";
diagram.AxisX.Title.TextColor = Color.Red;
diagram.AxisX.Title.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisX.Title.DXFont = new DXFont("Tahoma", 14, DXFontStyle.Bold);
// Customize the appearance of the Y-axis title.
diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisY.Title.Alignment = StringAlignment.Center;
diagram.AxisY.Title.Text = "Y-axis Title";
diagram.AxisY.Title.TextColor = Color.Blue;
diagram.AxisY.Title.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisY.Title.DXFont = new DXFont("Tahoma", 14, DXFontStyle.Bold);
// Add the chart to the form.
chartControl1.Dock = DockStyle.Fill;
this.Controls.Add(chartControl1);
}
}
}
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.Drawing
Imports DevExpress.XtraCharts
Namespace AxisTitle
Public Partial Class Form1
Inherits Form
' ...
' Hide the legend (if necessary).
chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False
' Cast the chart's diagram to the XYDiagram type, to access its axes.
Dim diagram As XYDiagram = TryCast(chartControl1.Diagram, XYDiagram)
' Customize the appearance of the X-axis title.
diagram.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True
diagram.AxisX.Title.Alignment = StringAlignment.Center
diagram.AxisX.Title.Text = "<i>X-axis</i> <color=violet>Title</color>"
diagram.AxisX.Title.TextColor = Color.Red
diagram.AxisX.Title.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True
diagram.AxisX.Title.DXFont = New DXFont("Tahoma", 14, DXFontStyle.Bold)
' Customize the appearance of the Y-axis title.
diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True
diagram.AxisY.Title.Alignment = StringAlignment.Center
diagram.AxisY.Title.Text = "Y-axis Title"
diagram.AxisY.Title.TextColor = Color.Blue
diagram.AxisY.Title.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True
diagram.AxisY.Title.DXFont = New DXFont("Tahoma", 14, DXFontStyle.Bold)
' Add the chart to the form.
chartControl1.Dock = DockStyle.Fill
Me.Controls.Add(chartControl1)
End Sub
End Class
End Namespace
Object ChartElement TitleBase Title AxisTitle AxisTitleX
See Also