categoryAxis.labelsObject

Configures the axis labels.

categoryAxis.labels.backgroundString

The background color of the labels. Any valid CSS color string will work here, including hex and rgb.

categoryAxis.labels.borderObject

The border of the labels.

categoryAxis.labels.border.colorString(default: "black")

The color of the border. Any valid CSS color string will work here, including hex and rgb.

categoryAxis.labels.border.dashTypeString(default: "solid")

The dash type of the border.

"solid"

Specifies a solid line.

"dot"

Specifies a line consisting of dots.

"dash"

Specifies a line consisting of dashes.

"longDash"

Specifies a line consisting of a repeating pattern of long-dash.

"dashDot"

Specifies a line consisting of a repeating pattern of dash-dot.

"longDashDot"

Specifies a line consisting of a repeating pattern of long-dash-dot.

"longDashDotDot"

Specifies a line consisting of a repeating pattern of long-dash-dot-dot.

categoryAxis.labels.border.widthNumber(default: 0)

The width of the border.

categoryAxis.labels.colorString

The text color of the labels. Any valid CSS color string will work here, including hex and rgb.

categoryAxis.labels.fontString(default: "12px Arial,Helvetica,sans-serif")

The font style of the labels.

categoryAxis.labels.formatString

The format of the labels.

categoryAxis.labels.marginNumber | Object(default: 0)

The margin of the labels.

Example

js
// sets the top, right, bottom and left margin to 3px.
margin: 3

// sets the top and left margin to 1px
// margin right and bottom are with 0px (by default)
margin: { top: 1, left: 1 }

categoryAxis.labels.mirrorBoolean

Mirrors the axis labels and ticks. If the labels are normally on the left side of the axis, mirroring the axis will render them to the right.

categoryAxis.labels.paddingNumber | Object(default: 0)

The padding of the labels.

Example

js
// sets the top, right, bottom and left padding to 3px.
padding: 3

// sets the top and left padding to 1px
// padding right and bottom are with 0px (by default)
padding: { top: 1, left: 1 }

categoryAxis.labels.rotationNumber(default: 0)

The rotation angle of the labels.

categoryAxis.labels.skipNumber(default: 1)

Number of labels to skip. Skips rendering the first n labels.

categoryAxis.labels.stepNumber(default: 1)

Label rendering step. Every n-th label is rendered where n is the step

categoryAxis.labels.templateString | Function

The template which renders the labels.

The fields which can be used in the template are:

  • value - the category value
  • dataItem - the data item, in case a field has been specified. If the category does not have a corresponding item in the data then an empty object will be passed.
  • format - the default format of the label
  • culture - the default culture (if set) on the label
  • index - the 0-based index of the current label
  • count - the total number of labels on the axis

categoryAxis.labels.visibleBoolean(default: true)

The visibility of the labels.

categoryAxis.labels.cultureString

Culture to use for formatting the dates. See Globalization for more information. It uses the global culture by default.

categoryAxis.labels.dateFormatsObject

Date format strings

"hours"

"HH:mm"

"days"

"M/d"

"weeks"

"M/d"

"months"

"MMM 'yy"

"years"

"yyyy"

The Chart will choose the appropriate format for the current baseUnit. Setting the labelsformatoption will override these defaults.