Labels

The Chart enables you to set the appearance and customize the content of the series and axis labels.

Setting the Appearance

You can control the appearance of the labels through the following properties:

  • background
  • border
  • color
  • font
  • margin
  • padding

The following example demonstrates how to customize the appearance of the axis label by using the ValueAxisLabels setting.

Example
View Source
Edit In Stackblitz  
Change Theme:

The following example demonstrates how to customize the appearance of the series label by using the SeriesLabels setting.

Example
View Source
Edit In Stackblitz  
Change Theme:

Customizing the Content

Normally, the series and axis Chart labels display an unformatted numeric value or a category name.

You can override the Chart label content by:

Using Format Strings

The Chart enables you to assign a format string for the label. For the full list of available formats, refer to the kendo-intl library.

Formatting Labels as Currency Values

The following example demonstrates how to format the value axis labels as a currency value.

Example
View Source
Edit In Stackblitz  
Change Theme:

The following example demonstrates how to format the series labels as a currency value.

Example
View Source
Edit In Stackblitz  
Change Theme:

Formatting Placeholders

Format strings for series labels can contain multiple value placeholdersfor example, an X and Y value for the Scatter series. The following table lists the available placeholders.

Series TypePlaceholders
Area, Bar, Column, Funnel, Line, and Pie{0}value
Box Plot
  • {0}lower
  • {1}q1
  • {2}median
  • {3}q3
  • {4}upper
  • {5}mean
  • {6}category
Bubble
  • {0}X value
  • {1}Y value
  • {2}size value
  • {3}category name
RangeBar and RangeArea
  • {0}from
  • {1}to
Scatter and ScatterLine
  • {0}X value
  • {1}Y value
Candlestick and OHLC
  • {0}open value
  • {1}high value
  • {2}low value
  • {3}close value
  • {4}category name

The following example demonstrates how to use value placeholders for the Scatter series labels.

Example
View Source
Edit In Stackblitz  
Change Theme:

Setting Content Callbacks

If provided, a content function is called to compute the text of each label. The function receives different parameters depending on the context. For more information, refer to the documentation on CategoryAxisLabelsComponent.content, ValueAxisLabelsComponent.content and SeriesLabelsComponent.content.

The following example demonstrates how to override the content of the axis labels.

Example
View Source
Edit In Stackblitz  
Change Theme:

The following example demonstrates how to override the content of the series labels.

Example
View Source
Edit In Stackblitz  
Change Theme:

Rendering Custom Visuals

You can customize the rendering of labels by using a visual function. The function receives a single parameter of type AxisLabelVisualArgs or SeriesLabelsVisualArgs, and returns a group of Drawing primitives to represent the label.

The following example demonstrates how to override the rendering of the axis labels.

Example
View Source
Edit In Stackblitz  
Change Theme:

The following example demonstrates how to override the rendering of the series labels.

Example
View Source
Edit In Stackblitz  
Change Theme: