Skip to main content
All docs
V25.1
  • TdxChartCrosshairAxisLabels.TextFormat Property

    Specifies a formatting pattern for crosshair axis labels.

    Declaration

    property TextFormat: TdxChartTextFormat read; write;

    Property Value

    Type Description
    TdxChartTextFormat

    The formatting pattern for crosshair axis labels.

    Remarks

    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.

    VCL Chart Control: Crosshair Argument and Value Axis Labels

    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.

    Text Format Examples

    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.

    VCL Chart Control: Free Crosshair Lines without Axis Label Patterns

    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;
    

    VCL Chart Control: Custom Formatting Patterns for Argument and Value Axis Labels

    Supported Placeholder Field Variables

    {V}
    A target point value (supported both in argument and value axis labels).
    {A}
    A target point argument (for crosshair argument axis labels).

    Supported Formatting Expressions

    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.

    ddddd
    An axis label displays only a date value. The ShortDateFormat field value defines the date format.
    dddddd
    An axis label displays only a date value. The LongDateFormat field value defines the date format.
    t
    An axis label displays only a time value. The ShortTimeFormat field value defines the time format.
    tt
    An axis label displays only a time value. The LongTimeFormat field value defines the time format.

    Placeholder Field Errors

    An axis label displays the following string if the specified formatting pattern contains an unsupported field: 'Variable "" not found!'.

    VCL Chart Control: Crosshair Axis Label Placeholder Errors

    Default Value

    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:

    VCL Chart Control: Default Axis Value Labels

    The default crosshair axis label formatting corresponds to the following pattern: '{V}'.

    See Also