Charts
TwPieChart
TwPieChart is a Blazor pie chart for parts of a whole. Set an inner radius for a donut chart, or draw it as a semicircle.
Last updated
Please be aware this component is new, may have bugs and/or be subject to change. Please report any bugs at
https://github.com/twblazor/twblazor/issues.
Basic usage
TwPieChart sizes each slice by its share of the whole. Pass a list of ChartValue. Slices large enough to hold a label show their share, and the legend names every slice.- Search
- Direct
- Social
- Referral
Donut
Set
InnerRadius between 0 and 0.9 to open a hole in the middle, and CenterText to put a headline figure in it.- Search
- Direct
- Social
- Referral
RAZOR
<TwChart Title="Traffic by source">
<TwPieChart Data="@_sources" InnerRadius="0.6" CenterText="1,000" />
</TwChart>Semicircle
Set
Semicircle for a half donut, which takes less vertical space.- Search
- Direct
- Social
- Referral
RAZOR
<TwChart Title="Traffic by source">
<TwPieChart Data="@_sources" InnerRadius="0.6" Semicircle="true" CenterText="1,000" />
</TwChart>Many values
A pie works for a handful of parts. Past eight values, the smallest are folded into one slice named by
OtherLabel so a color is never reused. The table view still lists every value.- United Kingdom
- United States
- Germany
- France
- Spain
- Italy
- Canada
- Rest of world
Labels
ShowPercentages turns the share labels off. LabelHeader and ValueHeader name the table columns, and ValueHeader also names the value in tooltips.Summary
Tooltips and the table view give the value of each slice. Tooltips also give its share of the whole.