DwsChartPolarArea
Compares values as equal slices of a circle whose radius shows each value, over a scale of rings. The chart stays square and fills its container on any screen, its colors are theme colors, and hovering, focusing or tapping a segment shows its value and its share of the total. The arrow keys move between segments, and the legend shows and hides them.
API ReferenceBasic
Only ChartData is needed: one segment per value, clockwise from 12 o'clock. Every segment gets the same angle; its radius shows its value on the scale of rings, whose values are written up from the center.
- Chat
- Phone
- Social media
- Forum
Show Code
PolarAreaChart.razor
<DwsChartPolarArea Name='PolarAreaChartDemo_Basic' ChartData='@_tickets' Title='Support tickets by channel' />PolarAreaChart.razor.cs
private readonly DwsChartPolarAreaData _tickets = new DwsChartPolarAreaData()
.Add("Email", 84)
.Add("Chat", 132)
.Add("Phone", 47)
.Add("Social media", 29)
.Add("Forum", 61);Dashboard cards: legend Auto, caption, loading and empty state
Two cards of a dashboard grid: side by side on a wide screen, one column on a phone. The chart measures its own width, so in a card narrower than 576px LegendPosition Auto puts the legend below the circle, and the scale values keep their screen size. A tap on a segment pins its tooltip until a tap elsewhere or Escape. Caption writes the takeaway under the chart (the drawing's aria-describedby points at it), IsLoading shows the loading state while the data is fetched, and EmptyContent replaces the empty-state text when there is nothing to draw.
Support tickets by channel, today
- Chat
- Phone
- Social media
- Forum
Chat carries the most tickets, ahead of email.
Open incidents by team
No open incidents.
Show Code
PolarAreaChart.razor
<DwsSwitch Name='PhoneLoading' @bind-Value='_phoneLoading' Label='IsLoading' Class='mb-3' />
<div class='row g-3'>
<div class='col-12 col-lg-6'>
<div class='border rounded p-3 h-100'>
<DwsTypography Name='TicketsCardTitle' Typography='DwsTypographyType.Paragraph' Class='fw-semibold mb-2'>Support tickets by channel, today</DwsTypography>
<DwsChartPolarArea Name='TicketsCardChart' ChartData='@_tickets' LegendPosition='DwsChartLegendPosition.Auto'
Caption='Chat carries the most tickets, ahead of email.' IsLoading='@_phoneLoading' />
</div>
</div>
<div class='col-12 col-lg-6'>
<div class='border rounded p-3 h-100'>
<DwsTypography Name='IncidentsCardTitle' Typography='DwsTypographyType.Paragraph' Class='fw-semibold mb-2'>Open incidents by team</DwsTypography>
<DwsChartPolarArea Name='IncidentsCardChart' ChartData='@_incidents' IsLoading='@_phoneLoading'>
<EmptyContent>
<DwsTypography Name='IncidentsEmptyText' Typography='DwsTypographyType.Paragraph' Class='mb-0'>No open incidents.</DwsTypography>
</EmptyContent>
</DwsChartPolarArea>
</div>
</div>
</div>PolarAreaChart.razor.cs
private bool _phoneLoading;
// Nothing open: the chart shows its EmptyContent.
private readonly DwsChartPolarAreaData _incidents = new();
private readonly DwsChartPolarAreaData _tickets = new DwsChartPolarAreaData()
.Add("Email", 84)
.Add("Chat", 132)
.Add("Phone", 47)
.Add("Social media", 29)
.Add("Forum", 61);Width and height
Width, Height, MinWidth, MaxWidth, MinHeight and MaxHeight size the chart in pixels, caption and legend included; the circle takes the largest square that fits. A Width without a height lets the circle fill that width. In a chart narrower than 576px the legend goes below and a fixed Height no longer applies, so the circle is not squeezed on a phone. Drag the corner of the first box: the chart is 360px high and keeps between 200px and 640px wide. The second chart is 260px wide.
- Chat
- Phone
- Social media
- Forum
Show Code
PolarAreaChart.razor
<div class='polar-demo-resizable'>
<DwsChartPolarArea Name='PolarAreaChartDemo_Size' ChartData='@_tickets' Height='360' MinWidth='200' MaxWidth='640' LegendPosition='DwsChartLegendPosition.Right' />
</div>
<DwsChartPolarArea Name='PolarAreaChartDemo_FixedWidth' ChartData='@_energy' Width='260' WithLegend='false' Class='mt-3' />
<style>
.polar-demo-resizable {
resize: horizontal;
overflow: auto;
width: 100%;
min-width: 0;
max-width: 100%;
padding: 0.5rem;
border: 1px dashed var(--secondary);
}
</style>PolarAreaChart.razor.cs
private readonly DwsChartPolarAreaData _tickets = new DwsChartPolarAreaData()
.Add("Email", 84)
.Add("Chat", 132)
.Add("Phone", 47)
.Add("Social media", 29)
.Add("Forum", 61);
private readonly DwsChartPolarAreaData _energy = new DwsChartPolarAreaData()
.Add("Kitchen", 1240)
.Add("Living room", 860)
.Add("Office", 1530)
.Add("Bathroom", 420)
.Add("Bedroom", 380)
.Add("Garage", 970);Interface-Description
| Name | Typ | Parameters | Description |
|---|---|---|---|
| GetDataAsCsv | string | CultureInfo? culture | The data the chart was given as CSV text (RFC 4180, CRLF, a header line): one row per mark in data order, the values as passed in. Null writes numbers the invariant way with commas between the cells; a culture writes them its way with its list separator. Text a spreadsheet would run as a formula gets an apostrophe in front. |
| ExportDataAsync | Task | string? fileName, CultureInfo? culture | Downloads GetDataAsCsv() as a .csv file (UTF-8 with a byte order mark). Null names the file after the chart's title, else its Name. |
| ExportSvgAsync | Task<string?> | A picture of the chart as it is on screen, as SVG markup: the drawing with the theme's colours and the fonts written into it, the title, the legend and the HTML texts drawn in where they stand, on a rectangle in the colour of the surface the chart lies on. Its size is the chart's size on screen in CSS pixels. Null when there is no picture (not interactive, no data, hidden). | |
| DownloadSvgAsync | Task | string? fileName | Downloads the picture of ExportSvgAsync() as an .svg file. Null names the file after the chart's title, else its Name. |
| DownloadPngAsync | Task | string? fileName, double scale | Downloads the picture as a .png file, scale times the chart's size on screen (2 is sharp on a high-density screen and in print; at most 8). Null names the file after the chart's title, else its Name. Text is drawn in the fonts installed on the device: a web font of the page is not available to the picture. |
| FocusAsync | ValueTask | bool containedInScrollableList | Focuses the segment that takes part in the tab order: the first shown one, or the one the user was on last. Does nothing while the chart is hidden, has no shown segment, is disabled or in permission select mode. |
| IsSeriesVisible | bool | int seriesIndex | With several series: whether the series at this position of SeriesData.Series is shown (not hidden through the legend). |
| IsSegmentVisible | bool | int index | Whether the segment at this position (DwsChartPolarAreaSegment.Index) is shown (not hidden through the legend). |
| Name | Typ | Default | Description |
|---|---|---|---|
| ChartData | DwsChartPolarAreaData? | null | The segments, clockwise: Segments (each with a Label, a Value, an optional Color and Tag). Add(label, value, color, tag) chains segments. A negative value, NaN or infinity is drawn as 0 with a warning. Null, or no segment, shows NoDataText. |
| SeriesData | DwsChartSeriesData? | null | Categories with several named series (the series model of DwsChartBar, Line, Area, Radar, Pie and RadialBar), instead of ChartData, which it replaces when both are set. Every category is a slice of the circle and the segments of its series share it (SeriesMode). A series takes its Color (Undefined: the next of Colors) or its CustomColor (a CSS color). The legend lists the series; tooltip and accessible names say category, series and value; ArrowLeft / ArrowRight move around the circle within a series, ArrowUp / ArrowDown through the series of a category, Home / End to its first and last category. A series without a value for a category (null, NaN, infinity) has no segment there; a negative value is drawn as 0 with a warning. With one series the chart is drawn as from ChartData. The segment handed to events and templates has CategoryIndex, SeriesIndex, SeriesName and Series. GetDataAsCsv() gets a Series column. |
| SeriesMode | DwsChartPolarAreaSeriesMode | DwsChartPolarAreaSeriesMode.Stacked | How the segments of several series share a category's slice. Stacked: one on top of the other along the radius, the first series at the center; the scale reaches out to the largest sum of a category. Grouped: side by side within the slice, each from the center; the scale reaches out to the largest value, and every shown series has the same place in every slice. Overlaid: over each other at the full width of the slice, each from the center, the larger segments drawn behind the smaller ones with a lighter fill (35 %); the scale reaches out to the largest value; the keyboard keeps the series order. StackedPercent: stacked as shares of the category, so every category reaches the outer ring and the scale reads 0 % to 100 %; the tooltip and the accessible name give the share of the category ("16.7% of Q1") instead of the share of the total, and hiding a series through the legend shares the category among the shown ones. |
| Title | string? | null | Caption above the chart, also its accessible name. |
| NoDataText | string? | null | Text shown when there is nothing to draw. Null uses the localized "No data to display". |
| Width | int? | null | Width in px. Never wider than the container unless MinWidth asks for more. Without a height the circle fills this width (beside a Left or Right legend: what the legend leaves). Null fills the container with a circle of a size that suits the screen. |
| Height | int? | null | Height in px, caption and legend included; the circle is the largest square that fits what is left. |
| MinWidth | int? | null | Smallest width in px; the only size that may make the chart wider than its container. |
| MaxWidth | int? | null | Largest width in px, and never more than the container. |
| MinHeight | int? | null | Smallest height in px; the circle grows to fill it. |
| MaxHeight | int? | null | Largest height in px; the circle shrinks to fit it. |
| Max | double? | null | Value of the outer ring. Null reaches out to a round value above the largest segment. Larger values are drawn up to the outer ring, with a warning; a value of 0 or less is ignored with a warning. |
| TickCount | int | 5 | About how many rings the scale gets (1 to 20); the scale picks round steps close to it. |
| ShowGrid | bool | true | Draws the rings of the scale and the lines between the segments. |
| ShowScale | bool | true | Labels the rings with their values, up from the center. On a circle narrower than 15rem (24rem with more than 6 rings) every other label is left out, so they do not overlap. |
| StartAngle | double | 0 | Where the first segment starts, in degrees clockwise from 12 o'clock. |
| ValueFormat | string | "#,0.##" | .NET number format for the values and the scale, in the current UI culture. An invalid format falls back to the default with a warning. |
| Colors | IReadOnlyList<DwsColor>? | null | Theme colors of the segments, clockwise, repeated when there are more segments; a segment's own Color wins. Null or empty uses Primary, Info, Success, Warning, Error, Accent, Link and Secondary. Undefined entries are skipped. |
| WithLegend | bool | true | Shows a legend with each segment's color and label. Hovering an entry fades the other segments (with HighlightOnHover). |
| LegendPosition | DwsChartLegendPosition | DwsChartLegendPosition.Bottom | Bottom, Top, Right or Left of the circle. Right and Left move below it on screens narrower than 576px. |
| EmptyContent | RenderFragment? | null | Shown instead of the empty-state text when there is no segment to draw (not while loading). |
| IsLoading | bool | false | Shows the loading state instead of the circle, e.g. while the page fetches the data. |
| Caption | string? | null | A sentence under the chart (<p class="dws-chart-caption">) - the takeaway or the source; the drawing's aria-describedby points at it. |
| ToggleSegmentsOnLegendClick | bool | true | Clicking a legend entry hides its segment (the entry stays, struck through) and clicking it again shows it. The shown segments share the circle; the scale keeps its rings. Hidden segments are shown again when the number of segments changes. |
| ShowTooltip | bool | true | Shows the label, value and share of the total of the hovered, focused or tapped segment. Escape hides it until the next segment. |
| TooltipTemplate | RenderFragment<DwsChartPolarAreaSegment>? | null | Content of the tooltip. Null shows the default detail. |
| HighlightOnHover | bool | true | Fades the other segments while one is hovered or focused, or while the pointer is on its legend entry. |
| Name | Typ | Description |
|---|---|---|
| OnSegmentClick | EventCallback<DwsChartPolarAreaSegment> | Raised when a segment is clicked, tapped or activated with Enter/Space. Not raised while disabled or in permission select mode (a click then selects the chart). |
| OnSegmentHover | EventCallback<DwsChartPolarAreaSegment?> | Raised when the pointer or focus enters a segment, and with null when neither is on one any more: also when the chart stops reacting (disabled, permission select mode) or the segment is hidden or gone. |
| OnLegendItemClick | EventCallback<DwsChartPolarAreaSegment> | Raised when a legend entry is clicked or activated, after its segment was shown or hidden. With a handler the entries are buttons even when ToggleSegmentsOnLegendClick is false. |
| OnSeriesToggle | EventCallback<DwsChartSeriesToggleEventArgs> | With several series (SeriesData): raised after a legend entry showed or hid its series (ToggleSegmentsOnLegendClick): SeriesIndex, Series, Visible. The rings of the scale stay; stacked, the series above a hidden one move in. OnLegendItemClick is for the segment entries of a chart without several series. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
