Class RadzenPieSeries<TItem>
A chart series that displays data as a circular pie chart with segments representing proportions of a whole. RadzenPieSeries is ideal for showing percentage breakdowns, composition analysis, or relative comparisons of parts to a total. Divides a circle into segments where each segment's angle is proportional to its value relative to the sum of all values. Supports segment color customization via Fills, borders via Strokes with custom radius and positioning, TotalAngle to create semi-circles or partial pie charts (e.g., gauge-like displays), StartAngle controlling where the first segment begins, optional labels showing values or percentages on segments, interactive tooltips showing category/value/percentage, and legend where each segment appears as a legend item using category values. Use CategoryProperty for segment labels (shown in legend/tooltip) and ValueProperty for the numeric value determining segment size. For a donut chart (pie with hollow center), use RadzenDonutSeries instead.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenPieSeries<TItem> : CartesianSeries<TItem>, IComponent, IHandleEvent, IHandleAfterRender, IChartSeries, IDisposable
Type Parameters
| Name | Description |
|---|---|
| TItem | The type of data items in the series. Each item represents one pie segment. |
Examples
Basic pie chart:
<RadzenChart>
<RadzenPieSeries Data=@marketShare CategoryProperty="Company" ValueProperty="Share" />
</RadzenChart>
Pie with custom colors and data labels:
<RadzenChart>
<RadzenPieSeries Data=@data CategoryProperty="Category" ValueProperty="Value"
Fills=@(new[] { "#FF6384", "#36A2EB", "#FFCE56", "#4BC0C0" })>
<RadzenSeriesDataLabels Visible="true" />
</RadzenPieSeries>
</RadzenChart>
Constructors
RadzenPieSeries()
A chart series that displays data as a circular pie chart with segments representing proportions of a whole. RadzenPieSeries is ideal for showing percentage breakdowns, composition analysis, or relative comparisons of parts to a total. Divides a circle into segments where each segment's angle is proportional to its value relative to the sum of all values. Supports segment color customization via Fills, borders via Strokes with custom radius and positioning, TotalAngle to create semi-circles or partial pie charts (e.g., gauge-like displays), StartAngle controlling where the first segment begins, optional labels showing values or percentages on segments, interactive tooltips showing category/value/percentage, and legend where each segment appears as a legend item using category values. Use CategoryProperty for segment labels (shown in legend/tooltip) and ValueProperty for the numeric value determining segment size. For a donut chart (pie with hollow center), use RadzenDonutSeries instead.
Declaration
public RadzenPieSeries()
Examples
Basic pie chart:
<RadzenChart>
<RadzenPieSeries Data=@marketShare CategoryProperty="Company" ValueProperty="Share" />
</RadzenChart>
Pie with custom colors and data labels:
<RadzenChart>
<RadzenPieSeries Data=@data CategoryProperty="Category" ValueProperty="Value"
Fills=@(new[] { "#FF6384", "#36A2EB", "#FFCE56", "#4BC0C0" })>
<RadzenSeriesDataLabels Visible="true" />
</RadzenPieSeries>
</RadzenChart>
Properties
Color
Gets the color.
Declaration
public override string Color { get; }
Property Value
| Type | Description |
|---|---|
| string | The color. |
Overrides
CoordinateSystem
Gets the coordinate system of the series.
Declaration
public override CoordinateSystem CoordinateSystem { get; }
Property Value
| Type | Description |
|---|---|
| CoordinateSystem | Coordinate system enum value. |
Overrides
CurrentRadius
Returns the current radius - either a specified Radius or automatically calculated one.
Declaration
protected double CurrentRadius { get; }
Property Value
| Type | Description |
|---|---|
| double |
Fills
Gets or sets a collection of fill colors applied to individual pie segments in sequence. Each segment gets the color at its index position. If fewer colors than segments, colors are reused cyclically. If not set, uses the chart's color scheme.
Declaration
[Parameter]
public IEnumerable<string> Fills { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> | An enumerable collection of CSS color values for segment backgrounds. |
PositiveItems
Stores Data filtered to items greater than zero as an IList of TItem.
Declaration
protected IList<TItem> PositiveItems { get; }
Property Value
| Type | Description |
|---|---|
| IList<TItem> | The items. |
Radius
Gets or sets the radius of the pie chart in pixels. If not set, the radius is automatically calculated to fit the available chart space.
Declaration
[Parameter]
public double? Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| double? | The radius in pixels, or null for automatic sizing. |
StartAngle
Gets or sets the starting angle (in degrees) from which pie segments begin rendering, measured clockwise from the right (0°). Use to rotate the pie: 90° (top), 0° (right), 180° (left), 270° (bottom).
Declaration
[Parameter]
public double StartAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| double | The start angle in degrees. Default is 90 (top of circle). |
StrokeWidth
Gets or sets the width of the pie segment borders in pixels. Set to 0 for no borders, or increase to make segment divisions more visible.
Declaration
[Parameter]
public double StrokeWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| double | The stroke width in pixels. Default is 0 (no borders). |
Strokes
Gets or sets a collection of stroke (border) colors applied to individual pie segments in sequence. Use with StrokeWidth to create visible segment borders.
Declaration
[Parameter]
public IEnumerable<string> Strokes { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> | An enumerable collection of CSS color values for segment borders. |
TotalAngle
Gets or sets the total angle span of the pie in degrees. Use 360 for a full circle, 180 for a semi-circle, or other values for partial pies (useful for gauge-like visualizations).
Declaration
[Parameter]
public double TotalAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| double | The total angle in degrees. Default is 360 (full circle). |
X
Gets or sets the horizontal center position of the pie chart in pixels. If not set, the pie is automatically centered horizontally within the chart area.
Declaration
[Parameter]
public double? X { get; set; }
Property Value
| Type | Description |
|---|---|
| double? | The X coordinate in pixels, or null for automatic horizontal centering. |
Y
Gets or sets the vertical center position of the pie chart in pixels. If not set, the pie is automatically centered vertically within the chart area.
Declaration
[Parameter]
public double? Y { get; set; }
Property Value
| Type | Description |
|---|---|
| double? | The Y coordinate in pixels, or null for automatic vertical centering. |
Methods
BuildRenderTree(RenderTreeBuilder)
A chart series that displays data as a circular pie chart with segments representing proportions of a whole. RadzenPieSeries is ideal for showing percentage breakdowns, composition analysis, or relative comparisons of parts to a total. Divides a circle into segments where each segment's angle is proportional to its value relative to the sum of all values. Supports segment color customization via Fills, borders via Strokes with custom radius and positioning, TotalAngle to create semi-circles or partial pie charts (e.g., gauge-like displays), StartAngle controlling where the first segment begins, optional labels showing values or percentages on segments, interactive tooltips showing category/value/percentage, and legend where each segment appears as a legend item using category values. Use CategoryProperty for segment labels (shown in legend/tooltip) and ValueProperty for the numeric value determining segment size. For a donut chart (pie with hollow center), use RadzenDonutSeries instead.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Contains(double, double, double)
Determines if the series contains the specified coordinates with a given tolerance.
Declaration
public override bool Contains(double x, double y, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | The x. |
| double | y | The y. |
| double | tolerance | The tolerance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
DataAt(double, double)
Returns the data at the specified coordinates;
Declaration
public override (object, Point) DataAt(double x, double y)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | The x. |
| double | y | The y. |
Returns
| Type | Description |
|---|---|
| (object, Point) |
Overrides
DegToRad(double)
Converts degrees to radians.
Declaration
protected double DegToRad(double degrees)
Parameters
| Type | Name | Description |
|---|---|---|
| double | degrees |
Returns
| Type | Description |
|---|---|
| double |
GetDataLabels(double, double)
Returns data chart position
Declaration
public override IEnumerable<ChartDataLabel> GetDataLabels(double offsetX, double offsetY)
Parameters
| Type | Name | Description |
|---|---|---|
| double | offsetX | |
| double | offsetY |
Returns
| Type | Description |
|---|---|
| IEnumerable<ChartDataLabel> |
Overrides
MeasureLegend()
Measures the legend.
Declaration
public override double MeasureLegend()
Returns
| Type | Description |
|---|---|
| double | System.Double. |
Overrides
Render(ScaleBase, ScaleBase)
Renders the series with the specified category and value scales.
Declaration
public override RenderFragment Render(ScaleBase categoryScale, ScaleBase valueScale)
Parameters
| Type | Name | Description |
|---|---|---|
| ScaleBase | categoryScale | The category scale. |
| ScaleBase | valueScale | The value scale. |
Returns
| Type | Description |
|---|---|
| RenderFragment | RenderFragment. |
Overrides
RenderLegendItem(bool)
Renders the legend item for this series.
Declaration
protected override RenderFragment RenderLegendItem(bool clickable)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | clickable |
Returns
| Type | Description |
|---|---|
| RenderFragment |
Overrides
Segment(double, double, double, double, double, double)
Creates SVG path that renders the specified segment.
Declaration
protected string Segment(double x, double y, double radius, double innerRadius, double startAngle, double endAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | The x. |
| double | y | The y. |
| double | radius | The radius. |
| double | innerRadius | The inner radius. |
| double | startAngle | The start angle. |
| double | endAngle | The end angle. |
Returns
| Type | Description |
|---|---|
| string |
ToCartesian(double, double, double, double)
Converts radial coordinates to to cartesian.
Declaration
protected (double X, double Y) ToCartesian(double x, double y, double radius, double degrees)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | The x. |
| double | y | The y. |
| double | radius | The radius. |
| double | degrees | The degrees. |
Returns
| Type | Description |
|---|---|
| (double a, double b) |
TooltipClass(TItem)
Gets the tooltip CSS class.
Declaration
protected override string TooltipClass(TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | item | The item. |
Returns
| Type | Description |
|---|---|
| string |
Overrides
TooltipStyle(TItem)
Gets the tooltip inline style.
Declaration
protected override string TooltipStyle(TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | item | The item. |
Returns
| Type | Description |
|---|---|
| string |