label

Specifies the options of the crosshair labels.

Type: Object

Crosshair labels indicate the argument and the value of the series point that the crosshair pointer currently focuses on. These labels use the chart axes to indicate the argument and the value on them.

There are two crosshair labels on a chart - one for each crosshair line. To specify the settings of both these labels, use the fields of the crosshair | label object. To specify these settings for each label individually, use the same fields within the crosshair | horizontalLine | label or crosshair | verticalLine | label object.

To make the crosshair labels visible, assign true to the label | visible field. Additionally, you can change the color of the label's background using the backgroundColor option and specify the font settings of the label's text using the font object.

backgroundColor

Specifies a color for the background of the crosshair labels.

Type: String
Default Value: '#f78119'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

customizeText

Customizes the text displayed by the crosshair labels.

Type: function(info)
Function parameters:
info: Object

Information about the point that is hovered over.

Object structure:

The argument or the value of the point that is hovered over.

valueText: String

The argument or the value with applied formatting.

point: Point

The point that is hovered over.

Return Value: String

The text to be displayed by the crosshair labels.

Cannot be used in themes.

Implement a callback function returning the required text and assign it to this option. Inside this function, you can access information about the point that is currently hovered over. For this purpose, use the parameter of the function or the this object.

The customizeText function specified in the crosshair | label object will be called twice - once for the horizontal line, and then for the vertical. To specify the customizeText option for one or another line only, use the horizontalLine | label or verticalLine | label object respectively.

For more information on data formatting, refer to the Data Formatting topic.

font

Specifies font options for the text of the crosshair labels.

Type: Object

format

Specifies the format of the values displayed by crosshair labels.

Type: String
Default Value: ''
Accepted Values: 'currency' | 'fixedPoint' | 'percent' | 'decimal' | 'exponential' | 'largeNumber' | 'thousands' | 'millions' | 'billions' | 'trillions' | 'longDate' | 'longTime' | 'monthAndDay' | 'monthAndYear' | 'quarterAndYear' | 'shortDate' | 'shortTime' | 'millisecond' | 'day' | 'month' | 'quarter' | 'year'

By default, crosshair labels display values as they are defined in the data source. You can apply formatting to these values using the format option. Additionally, if you have decided to use a numeric format, you can specify how many figures to keep when rounding the values. For this purpose, use the precision option. For details on formatting, refer to the Data Formatting topic.

precision

Specifies a precision for formatted values.

Type: Number
Default Value: 0

If you have set a numeric format for values, you can use the precision property to specify how many figures to keep when rounding the value. This property accepts integers only. For general information on data formatting, refer to the Data Formatting topic.

visible

Specifies whether the crosshair labels are visible or not.

Type: Boolean
Default Value: false