Skip to main content

AlignedTitle.MaxLineCount Property

Gets or sets the number of lines to which a title’s text is allowed to wrap.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.dll

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public int MaxLineCount { get; set; }

Property Value

Type Description
Int32

An integer which is the number of text lines. Should be greater than or equal to 0 and less than or equal to 20.

Remarks

Use the MaxLineCount property to define the number of lines to which a title is allowed to wrap when its DevExpress.XtraCharts.DockableTitle.WordWrap property is enabled. Both these properties allow you to control a diagram’s size when a title is too lengthy.

Note that if a title’s length exceeds the limit defined by the MaxLineCount property, the last line of text will be cut off by an ellipsis. To force a chart title to fully display its contents without regard to the title’s size, and therefore the chart’s diagram dimensions, set the MaxLineCount property to 0.

The following images demonstrate how these properties work for a chart title.

WordWrap = false

WordWrap = true

MaxLinesCount = 0

WordWrap = true

MaxLinesCount = 2

ChartTitles_2a

ChartTitles_2b

ChartTitles_2c

Example

This example demonstrates how word-wrapping can be enabled for chart titles at runtime. In addition, you can determine the maximum number of lines in which a title is allowed to wrap.

// Create a title and add it to the chart's collection.
ChartTitle chartTitle1 = new ChartTitle();
ChartControl1.Titles.Add(chartTitle1);
chartTitle1.Text = "Just a Very Lengthy Title for Such a Small Chart";

// Enable word-wrapping for the title,
// and define a limit for its lines.
chartTitle1.WordWrap = true;
chartTitle1.MaxLineCount = 2;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MaxLineCount property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also