Label Template and Format
The StockChart for Blazor can render labels on the axes and the navigator. You can control these texts not only through the values you bind to data but also through format strings or templates.
You can also rotate the labels by setting the Angle parameter to a numeric value the labels will rotate to.
In this article:
Format Strings
You can use the Format parameter to apply standard numeric format strings and date and time format strings.
Format the labels on the Value and Category Axes
Templates
You can use the Template parameter to apply more complex formatting to the labels in the StockChart for Blazor. The syntax of the template is based on the Kendo Templates. The labels are not HTML elements so the Template cannot contain arbitrary HTML elements. If you want to add a new line, use the \n symbol instead of a block HTML element.
To format the values, you need to call a JavaScript function that will return the desired new string based on the template value you pass to it. You can find examples of this in the How to format the percent in a label for a pie or donut chart knowledge base article and the Label Format - Complex Logic sample project.
Template Fields
In a category axis label template, you can use the following fields:
value- the category valueformat- the default format of the label
In a value axis label template, you can use the following fields:
value- the label value
Example
The template syntax works the same way for the Telerik UI for Blazor Chart and StockChart.
Custom templates in labels