New to Kendo UI for Angular? Start a free 30-day trial

Labels

The Angular Chart enables you to set the appearance and customize the content of the series and axis labels. By default, the series and axis Chart labels display an unformatted numeric value or a category name without styling.

Customizing the Label Appearance

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

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

Axis Labels

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

Example
View Source
Change Theme:

Series Labels

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

Example
View Source
Change Theme:

Customizing the Label Content

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

Using Format Strings

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

Showing Format Labels as Currency Values

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

Example
View Source
Change Theme:

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

Example
View Source
Change Theme:

Using Format Placeholders

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

Series TypePlaceholders
Area, Bar, Column, Funnel, Pyramid, 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
Bullet
  • {0}—Value
  • {1}—Target value
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
Change Theme:

Using Content Function 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
Change Theme:

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

Example
View Source
Change Theme:

The following example demonstrates how to render the label content in multiple lines.

Example
View Source
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
Change Theme:

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

Example
View Source
Change Theme:

Support and Learning Resources

Additional Resources