Donut Chart

以圆环展示整体的各个部分:每部分一个扇段,中心显示总计,图例附带数值,可悬停或用方向键逐段浏览。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

  • Chrome275
  • Safari200
  • Firefox187
  • Edge173
  • Other90
Visitors by browser, January to June 2026
BrowserVisitorsShare
Chrome27530%
Safari20022%
Firefox18720%
Edge17319%
Other9010%

导入

ts
import {
  SoneDonutChartComponent,
} from "@surface-one/angular/donut-chart";

API 参考

SoneDonutChartComponent组件

`<sone-donut-chart>` — the parts of a whole as a ring (shadcn/ui Pie Chart, donut with text): one segment per part, clockwise from 12 o'clock, the total (or the hovered or focused segment) in the centre and a legend. One Tab stop with a roving focus over the segments (arrow keys, Home/End, Escape returns the centre to the total); each segment is an image named “Chrome: 275 (39%)”, and a visually hidden table carries the data.

选择器
sone-donut-chart
输入
名称类型 默认值
segments

The parts, clockwise from 12 o'clock; zero and negative values draw nothing.

readonly SoneDonutChartSegment[][]
size

The ring's diameter in CSS pixels (it shrinks to fit a narrower container).

number200
thickness

The ring's width as a part of its radius: 0.3 by default, 1 draws a pie.

number0.3
padAngle

The gap between neighbouring segments, in degrees.

number1
label

The caption under the centre value.

—$localize`Total`
centerValue

The centre value at rest; default: the formatted total.

string | nullnull
legend

Shows the legend under the ring.

booleantrue
ariaLabel

Names the chart and captions its data table (“Visitors by browser”).

string""
valueFormat

Formats values in the centre, the names and the data table.

SoneDonutChartFormatdefaultFormat
categoryHeader

The data table's column headers.

—$localize`Category`
valueHeader—$localize`Value`
shareHeader—$localize`Share`