You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -86,7 +86,9 @@ To set a template for the corresponding label, use the `Template` property in th
86
86
87
87
After the example, you can find lists with the available fields you can use in templates.
88
88
89
-
To add a new line, use the `\n` symbol.
89
+
To add a new line, use the `\n` symbol. The other available objects are added through the `#=theObject#` syntax. You can find more details in the code samples below (including simple if-block logic).
90
+
91
+
The general syntax of the templates is based on the [Kendo Templates](https://docs.telerik.com/kendo-ui/framework/templates/overview). Note that the chart labels are not HTML elements and you cannot use HTML in them, only plain strings are allowed. Also, the various helper functions that come from the Kendo jQuery library are not available in Blazor (for example, `kendo.toString()` or `kendo.format()`).
90
92
91
93
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 an example of this in the [How to format the percent in a label for a pie or donut chart]({%slug chart-format-percent%}) knowledge base article.
92
94
@@ -167,7 +169,7 @@ Label templates
167
169
In a **series label template**, you can use the following fields:
168
170
169
171
*`category` - the category name. Available for area, bar, column, donut, line, pie series.
170
-
*`dataItem` - the original data item used to construct the point. Will be `null` if binding to array.
172
+
*`dataItem` - the original data item used to construct the point. Will be `null` if binding to array. Sample syntax: `#=dataItem.MyModelFieldName#`.
171
173
*`percentage` - the point value represented as a percentage value. Available only for donut, pie and 100% stacked charts.
172
174
*`stackValue` - the cumulative point value on the stack. Available only for stackable series.
173
175
*`value` - the point value. Can be a number or object containing each bound field.
@@ -205,6 +207,8 @@ To do that, you need to:
205
207
* add conditional logic in the template that renders the desired content when your condition is met, and returns nothing when it is not.
206
208
* ensure the labels background is transparent so there are no leftover spots on the chart.
207
209
210
+
This example also showcases basic logic use in the templates that does not require external functions.
0 commit comments