Axis.Title Property
Provides access to options used to display and format the axis title.
Namespace: DevExpress.Spreadsheet.Charts
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
ChartTitleOptions | A ChartTitleOptions object containing display settings for titles on a chart. |
Remarks
Use the Title property to access an object exposing the ChartTitleOptions interface, which inherits the ChartText and ShapeFormatBase interfaces. Use this object’s members to display or hide the axis title (by setting the ChartTitleOptions.Visible property), to specify the text for the title (by using the ChartText.SetValue or ChartText.SetReference method), to adjust the position of the title (via the ChartTitleOptions.Layout property) and modify the title appearance (by utilizing the ShapeFormatBase.Fill and ShapeFormatBase.Outline properties).
Example
The following example demonstrates how to create a clustered bar chart and add the title to the value axis using the Axis.Title
property, which returns the ChartTitleOptions object containing basic title options. Set the ChartTitleOptions.Visible property to true to display the axis title. To explicitly specify the text for the title, utilize the ChartText.SetValue method.
Worksheet worksheet = workbook.Worksheets["chartTask2"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.BarClustered, worksheet["B4:C7"]);
chart.TopLeftCell = worksheet.Cells["E3"];
chart.BottomRightCell = worksheet.Cells["K14"];
// Specify the axis title text.
chart.PrimaryAxes[1].Title.Visible = true;
chart.PrimaryAxes[1].Title.SetValue("Shipment in millions of units");
// Hide the legend.
chart.Legend.Visible = false;
// Specify that each data point in the series has a different color.
chart.Views[0].VaryColors = true;