All Components

XAxisLabels

The configuration of the X-axis labels.

background? string

The background color of the labels. Accepts a valid CSS color string, including hex and rgb.

border? Border

The border of the labels.

color? string

The text color of the labels. Accepts a valid CSS color string, including hex and rgb.

content? (e: any) => string

The function which returns the label content.
The function argument contains a value field which defines the axis value.
You can split the text into multiple lines by using the line feed characters ("\n").

culture? string

The culture to use when formatting date values.
The specified culture must be loaded as demonstrated in the Internationalization Overview.

dateFormats? DateFormats

The format for displaying the labels when the X values are dates. Uses the format method of IntlService.
Contains one placeholder ("{0}") which represents the category value.
The Chart selects the appropriate format for the current xAxis.baseUnit. Setting the
categoryAxis.labels.format option overrides the date formats.

font? string

The font style of the labels.

format? string

The format for displaying the labels. Uses the format method of IntlService.
Contains one placeholder ("{0}") which represents the category value.

margin? Margin | number

The margin of the labels. A numeric value sets all margins.

mirror? boolean

If set to true, the Chart mirrors the axis labels and ticks. If the labels are normally on the
left side of the axis, the mirroring of the axis renders them to the right.

padding? Padding | number

The padding of the labels. A numeric value sets all paddings.

position AxisLabelsPosition

The position of the axis labels. By default, labels are positioned next to the axis.

  • When position is set to end, the labels are placed at the end of the crossing axis— typically, at the top or right end of the Chart unless the crossing axis was reversed.
  • When position is set to start, the labels are placed at the start of the crossing axis— typically, at the left or bottom end of the Chart unless the crossing axis was reversed.

rotation? LabelRotation | number | "auto"

The rotation angle of the labels. By default, the labels are not rotated. Can be set to "auto".
In this case, the labels are rotated only if the slot size is not sufficient for the entire labels.

skip? number

The number of labels to skip.

step? number

The label rendering step—renders every nth label. By default, every label is rendered.

visible? boolean

If set to true, the Chart displays the X-axis labels. By default, the X-axis labels are visible.

visual? (e: AxisLabelVisualArgs) => Element

A function for creating custom visuals for the labels.

The available argument fields are:

  • createVisual—A function that can be used to get the default visual.
  • culture—The default culture (if set) of the label.
  • format—The default format of the label.
  • options—The label options.
  • rect—The geometry Rect that defines where the visual has to be rendered.
  • sender—The Chart instance (might be undefined).
  • text—The label text.
  • value—The category value.
In this article