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 ChartValueAxisLabels
component.
The following example demonstrates how to customize the appearance of the series label by using the ChartSeriesLabels
component.
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.
The following example demonstrates how to format the series labels as a currency value.
Formatting 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 Type | Placeholders |
---|---|
Area, Bar, Column, Funnel, Pyramid, Line, and Pie | {0}—value |
Box Plot |
|
Bubble |
|
Bullet |
|
RangeBar and RangeArea |
|
Scatter and ScatterLine |
|
Candlestick and OHLC |
|
The following example demonstrates how to use value placeholders for the Scatter series labels.
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 ChartCategoryAxisLabelsProps
, ChartValueAxisLabelsProps
, and ChartSeriesLabelsProps
.
The following example demonstrates how to override the content of the axis labels.
The following example demonstrates how to override the content of the series labels.
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.
The following example demonstrates how to override the rendering of the series labels.