Skip to content

Commit 87e0347

Browse files
docs(chart): example of formatting values in a template
1 parent 502f976 commit 87e0347

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/chart/labels-template-and-format.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ The Chart for Blazor can render labels on the axes, series data points and legen
1414

1515
To turn on series labels, you must set their `Visible` property to `true` under the corresponding `ChartSeriesLabels` tag. The series labels are turned off by default to avoid clutter and to make the charts easier to read.
1616

17+
You can jump to the following sections in this article:
18+
19+
* [Format Strings](#format-strings)
20+
* [Templates](#templates)
21+
* [Hide Label Conditionally](#hide-label-conditionally)
22+
1723
## Format Strings
1824

1925
Where the labels are numerical (series values, the value axis), you can format those strings through the `Format` property of the corresponding labels inner tag. This lets you set [standard numeric format strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings) to the values to showcase, for example, percentage, currency, and so on.
@@ -82,6 +88,8 @@ After the example, you can find lists with the available fields you can use in t
8288

8389
To add a new line, use the `\n` symbol.
8490

91+
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+
8593
>caption Custom templates in labels
8694
8795
````CSHTML

0 commit comments

Comments
 (0)