vcl-dxchartxydiagram-dot-tdxchartcrosshairaxislabels-1cd93944.md
Specifies a formatting pattern for crosshair axis labels.
property TextFormat: TdxChartTextFormat read; write;
| Type | Description |
|---|---|
| TdxChartTextFormat |
The formatting pattern for crosshair axis labels.
|
Crosshair argument and value axis labels complement crosshair lines and display arguments and values that correspond to crosshair line positions within the XY diagram area.
You can use the TextFormat property to define a formatting pattern for crosshair axis labels. The formatting pattern can consist of static content (such as measurement units) and one or more placeholder fields. A placeholder field is an expression enclosed in curly brackets that starts with a supported placeholder variable followed by a colon and a value formatting expression.
A custom formatting pattern is particularly useful for crosshair axis labels that correspond to crosshair lines that follow the mouse pointer freely rather than snap to series points because axis labels display coordinates without decimal place limitations.
The following code example defines custom patterns for argument and value axis labels in a Chart control with one XY diagram:
var
AXYDiagram: TdxChartXYDiagram;
begin
AXYDiagram := dxChartControl1.Diagrams[0] as TdxChartXYDiagram;
AXYDiagram.Axes.AxisX.CrosshairLabels.TextFormat := '{A:yyyy mmmm}'; // A custom date format
AXYDiagram.Axes.AxisY.CrosshairLabels.TextFormat := '${V:0.00}k'; // A custom numeric format
end;
TdxChartXYDiagram *AXYDiagram;
// ...
AXYDiagram = dynamic_cast<TdxChartXYDiagram*>(dxChartControl1.Diagrams[0]);
AXYDiagram->Axes->AxisX->CrosshairLabels->TextFormat = "{A:yyyy mmmm}"; // A custom date format
AXYDiagram->Axes->AxisY->CrosshairLabels->TextFormat = "${V:0.00}k"; // A custom numeric format
{V}A target point value (supported both in argument and value axis labels).{A}A target point argument (for crosshair argument axis labels).
The Chart control supports all Spreadsheet-compatible formats as well as the following formatting expressions for date/time values in {V} and {A} placeholder fields:
c
An axis label displays a date followed by a time value. ShortDateFormat and LongTimeFormat field values define date and time formats, respectively.
Note
The time value is hidden if it matches midnight.
dddddAn axis label displays only a date value. The ShortDateFormat field value defines the date format.ddddddAn axis label displays only a date value. The LongDateFormat field value defines the date format.tAn axis label displays only a time value. The ShortTimeFormat field value defines the time format.ttAn axis label displays only a time value. The LongTimeFormat field value defines the time format.
An axis label displays the following string if the specified formatting pattern contains an unsupported field: 'Variable "" not found!'.
The TextFormat property’s default value is an empty string.
The default TextFormat property value indicates that a crosshair axis label displays the target argument or value as is:
The default crosshair axis label formatting corresponds to the following pattern: '{V}'.
See Also
TdxChartCustomLabels.TextFormat Property
TdxChartDiagramToolTipOptions.PointToolTipFormat Property
TdxChartDiagramToolTipOptions.SeriesToolTipFormat Property
TdxChartSeriesToolTipOptions.PointToolTipFormat Property
TdxChartSeriesToolTipOptions.SeriesToolTipFormat Property
TdxChartCrosshairAxisLabels Class