vcl-dxchartcore-dot-tdxchartcustomlegend-cfc5bbc6.md
Specifies the maximum caption width (in pixels) in multi-column and narrow vertical legend pane layouts.
property MaxCaptionWidth: Single read; write;
| Type | Description |
|---|---|
| Single |
The maximum caption width (in pixels) in multi-column and narrow vertical legend pane layouts at 96 DPI.
The property value can be 0 or higher.
|
Use the MaxCaptionWidth property to adjust the maximum width of legend item captions when the legend pane width allocated to legend items is limited. For example, the MaxCaptionWidth property is useful when you need to fine tune the legend pane whose maximum width is limited and the Direction property is set to TdxChartLegendDirection.LeftToRight or TdxChartLegendDirection.RightToLeft.
If a legend item caption’s width exceeds the MaxCaptionWidth property value in a horizontal legend pane layout with constrained width, the legend pane truncates the caption and displays an ellipsis.
| Value | Example[1] |
|---|---|
120 ( default )[2] | |
30[3] |
The MaxCaptionWidth property setter changes an assigned negative value to 0.
The MaxCaptionWidth property specifies the base maximum legend item caption width (in pixels) that corresponds to 96 DPI. The Chart control’s draw routines multiply the MaxCaptionWidth property value by the current scale factor and round the result to the nearest integer to calculate actual item caption width on the target screen.
The MaxCaptionWidth property has no effect when the legend pane allocates sufficient space to display all legend items in full with the current settings.
The MaxCaptionWidth property’s default value is the DefaultMaxCaptionWidth typed constant.
Footnotes
This example demonstrates different MaxCaptionWidth property values on the same legend pane under the following conditions:
The maximum caption width allows the legend pane to display item captions in full but the current legend width constraint (MaxWidthPercent is set to 30) arranges legend items in one column.
The maximum caption width truncates legend items so their resulting width allows the legend pane to fit two columns of items into the current legend width constraint (MaxWidthPercent is set to 30).
See Also
TdxChartCustomLegend.Direction Property