- Prop
data- Type
ChartDonutDatum[]- Default
- —
- Requirement
- required
DonutChart
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { DonutChart } from "@grassroot/charts-react"; const donutData = [ { label: "Direct web", value: 812, color: "var(--accent)", }, { label: "Partner referrals", value: 546, color: "var(--vs-success)", }, { label: "Renewals", value: 418, color: "var(--vs-warning)", }, { label: "Marketplace", value: 267, color: "var(--vs-info)", }, { label: "Field sales", value: 194, color: "var(--vs-error)", }, { label: "Events", value: 128, color: "var(--vs-neutral-400)", }, { label: "Community", value: 86, color: "var(--accent)", }, { label: "Reseller", value: 73, color: "var(--vs-success)", },]; export default function DonutChartDemo() { return ( <div> <DonutChart animation={{ durationMs: 560, staggerMs: 44 }} centerLabel="£2.52M" centerSub="Q2 REVENUE" data={donutData} ariaLabel="Second-quarter revenue of 2.52 million pounds, split by eight sales channels" /> </div> );}- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script setup lang="ts">import { DonutChart } from "@grassroot/charts-vue"; const donutData = [ { label: "Direct web", value: 812, color: "var(--accent)", }, { label: "Partner referrals", value: 546, color: "var(--vs-success)", }, { label: "Renewals", value: 418, color: "var(--vs-warning)", }, { label: "Marketplace", value: 267, color: "var(--vs-info)", }, { label: "Field sales", value: 194, color: "var(--vs-error)", }, { label: "Events", value: 128, color: "var(--vs-neutral-400)", }, { label: "Community", value: 86, color: "var(--accent)", }, { label: "Reseller", value: 73, color: "var(--vs-success)", },];</script> <template> <div> <DonutChart :animation="{ durationMs: 560, staggerMs: 44 }" centerLabel="£2.52M" centerSub="Q2 REVENUE" :data="donutData" aria-label="Second-quarter revenue of 2.52 million pounds, split by eight sales channels" /> </div></template>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootDonutChart } from "@grassroot/charts-angular"; @Component({ selector: "app-donut-chart-chart-demo", standalone: true, imports: [GrassrootDonutChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-donut-chart [animation]="{ durationMs: 560, staggerMs: 44 }" centerLabel="£2.52M" centerSub="Q2 REVENUE" [data]="donutData" ariaLabel="Second-quarter revenue of 2.52 million pounds, split by eight sales channels" />`,})export class DonutChartDemoComponent { readonly donutData = [ { label: "Direct web", value: 812, color: "var(--accent)", }, { label: "Partner referrals", value: 546, color: "var(--vs-success)", }, { label: "Renewals", value: 418, color: "var(--vs-warning)", }, { label: "Marketplace", value: 267, color: "var(--vs-info)", }, { label: "Field sales", value: 194, color: "var(--vs-error)", }, { label: "Events", value: 128, color: "var(--vs-neutral-400)", }, { label: "Community", value: 86, color: "var(--accent)", }, { label: "Reseller", value: 73, color: "var(--vs-success)", }, ];} export default DonutChartDemoComponent;- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script lang="ts"> import { DonutChart } from "@grassroot/charts-svelte"; const donutData = [ { label: "Direct web", value: 812, color: "var(--accent)", }, { label: "Partner referrals", value: 546, color: "var(--vs-success)", }, { label: "Renewals", value: 418, color: "var(--vs-warning)", }, { label: "Marketplace", value: 267, color: "var(--vs-info)", }, { label: "Field sales", value: 194, color: "var(--vs-error)", }, { label: "Events", value: 128, color: "var(--vs-neutral-400)", }, { label: "Community", value: 86, color: "var(--accent)", }, { label: "Reseller", value: 73, color: "var(--vs-success)", }, ];</script> <div> <DonutChart animation={{ durationMs: 560, staggerMs: 44 }} centerLabel="£2.52M" centerSub="Q2 REVENUE" data={donutData} ariaLabel="Second-quarter revenue of 2.52 million pounds, split by eight sales channels" /></div>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
/** @jsxImportSource solid-js */import { DonutChart } from "@grassroot/charts-solid"; const donutData = [ { label: "Direct web", value: 812, color: "var(--accent)", }, { label: "Partner referrals", value: 546, color: "var(--vs-success)", }, { label: "Renewals", value: 418, color: "var(--vs-warning)", }, { label: "Marketplace", value: 267, color: "var(--vs-info)", }, { label: "Field sales", value: 194, color: "var(--vs-error)", }, { label: "Events", value: 128, color: "var(--vs-neutral-400)", }, { label: "Community", value: 86, color: "var(--accent)", }, { label: "Reseller", value: 73, color: "var(--vs-success)", },]; export default function DonutChartDemo() { return ( <div> <DonutChart animation={{ durationMs: 560, staggerMs: 44 }} centerLabel="£2.52M" centerSub="Q2 REVENUE" data={donutData} ariaLabel="Second-quarter revenue of 2.52 million pounds, split by eight sales channels" /> </div> );}Installation
API Reference
Import
import { DonutChart } from "@grassroot/charts-react";
Props
Prop
Type
Default
Requirement
dataChartDonutDatum[]—
required
centerLabelstring | undefined—
optional
centerSubstring | undefined—
optional
rendererChartRenderer | undefined—
optional
classNamestring | undefined—
optional
themeimport("@grassroot/theme").PartialChartTheme | undefined—
optional
animationimport("@grassroot/theme").ChartAnimationInput | undefined—
optional
titlestring | undefined—
optional
descriptionstring | undefined—
optional
ariaLabelstring | undefined—
optional
- Prop
centerLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
centerSub- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
theme- Type
import("@grassroot/theme").PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Prop
animation- Type
import("@grassroot/theme").ChartAnimationInput | undefined- Default
- —
- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean | undefined- Default
- —
- Requirement
- optional
Content regions
dataSummary
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { DonutChart } from "@grassroot/charts-vue";
Props
Prop
Type
Default
Requirement
datareadonly DonutDatum[]—
required
innerRadiusnumber | undefined—
optional
centerLabelstring | undefined—
optional
centerSubstring | undefined—
optional
ariaLabelstring | undefined—
optional
rendererChartRenderer | undefined—
optional
themePartialChartTheme | undefined—
optional
animationChartAnimationInput | undefined—
optional
titlestring | undefined—
optional
descriptionstring | undefined—
optional
classNamestring | undefined—
optional
- Prop
data- Type
readonly DonutDatum[]- Default
- —
- Requirement
- required
- Prop
innerRadius- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
centerLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
centerSub- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer | undefined- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput | undefined- Default
- —
- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Content regions
dataSummary
Import
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootDonutChart } from "@grassroot/charts-angular";
Props
Prop
Type
Default
Requirement
datareadonly DonutDatum[]—
required
innerRadiusnumber—
optional
centerLabelstring—
optional
centerSubstring—
optional
ariaLabelstring—
optional
rendererChartRenderer—
optional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
titlestring—
optional
descriptionstring—
optional
classNamestring—
optional
- Prop
data- Type
readonly DonutDatum[]- Default
- —
- Requirement
- required
- Prop
innerRadius- Type
number- Default
- —
- Requirement
- optional
- Prop
centerLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
centerSub- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
dataSummary
Import
import { DonutChart } from "@grassroot/charts-svelte";
Props
Prop
Type
Default
Requirement
datareadonly DonutDatum[]—
required
innerRadiusnumber—
optional
centerLabelstring—
optional
centerSubstring—
optional
ariaLabelstring—
optional
rendererChartRenderer—
optional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
titlestring—
optional
descriptionstring—
optional
classstring—
optional
- Prop
data- Type
readonly DonutDatum[]- Default
- —
- Requirement
- required
- Prop
innerRadius- Type
number- Default
- —
- Requirement
- optional
- Prop
centerLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
centerSub- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
Content regions
dataSummary
Import
import { DonutChart } from "@grassroot/charts-solid";
Props
Prop
Type
Default
Requirement
datareadonly DonutDatum[]—
required
innerRadiusnumber—
optional
centerLabelstring—
optional
centerSubstring—
optional
ariaLabelstring—
optional
classstring—
optional
rendererChartRenderer—
optional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
titlestring—
optional
descriptionstring—
optional
- Prop
data- Type
readonly DonutDatum[]- Default
- —
- Requirement
- required
- Prop
innerRadius- Type
number- Default
- —
- Requirement
- optional
- Prop
centerLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
centerSub- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
Content regions
dataSummary