Docs Charts Core charts

DonutChart

React example follows below.
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>
);
}
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>
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;
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>
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
data
ChartDonutDatum[]
—
required
centerLabel
string | undefined
—
optional
centerSub
string | undefined
—
optional
renderer
ChartRenderer | undefined
—
optional
className
string | undefined
—
optional
theme
import("@grassroot/theme").PartialChartTheme | undefined
—
optional
animation
import("@grassroot/theme").ChartAnimationInput | undefined
—
optional
title
string | undefined
—
optional
description
string | undefined
—
optional
ariaLabel
string | undefined
—
optional
keyboardNavigation
boolean | undefined
—
optional
Prop
data
Type
ChartDonutDatum[]
Default
—
Requirement
required
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
data
readonly DonutDatum[]
—
required
innerRadius
number | undefined
—
optional
centerLabel
string | undefined
—
optional
centerSub
string | undefined
—
optional
ariaLabel
string | undefined
—
optional
renderer
ChartRenderer | undefined
—
optional
theme
PartialChartTheme | undefined
—
optional
animation
ChartAnimationInput | undefined
—
optional
title
string | undefined
—
optional
description
string | undefined
—
optional
keyboardNavigation
boolean | undefined
—
optional
className
string | 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
data
readonly DonutDatum[]
—
required
innerRadius
number
—
optional
centerLabel
string
—
optional
centerSub
string
—
optional
ariaLabel
string
—
optional
renderer
ChartRenderer
—
optional
theme
PartialChartTheme
—
optional
animation
ChartAnimationInput
—
optional
title
string
—
optional
description
string
—
optional
keyboardNavigation
boolean
—
optional
className
string
—
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
data
readonly DonutDatum[]
—
required
innerRadius
number
—
optional
centerLabel
string
—
optional
centerSub
string
—
optional
ariaLabel
string
—
optional
renderer
ChartRenderer
—
optional
theme
PartialChartTheme
—
optional
animation
ChartAnimationInput
—
optional
title
string
—
optional
description
string
—
optional
keyboardNavigation
boolean
—
optional
class
string
—
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
data
readonly DonutDatum[]
—
required
innerRadius
number
—
optional
centerLabel
string
—
optional
centerSub
string
—
optional
ariaLabel
string
—
optional
class
string
—
optional
renderer
ChartRenderer
—
optional
theme
PartialChartTheme
—
optional
animation
ChartAnimationInput
—
optional
title
string
—
optional
description
string
—
optional
keyboardNavigation
boolean
—
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