- Prop
labels- Type
string[]- Default
- —
- Requirement
- required
- Description
- —
StackedBarChart
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
const stackedBarChartFixture = { id: "stacked-bar-chart", labels: [ "Q1 2024", "Q2 2024", "Q3 2024", "Q4 2024", "Q1 2025", "Q2 2025", "Q3 2025", "Q4 2025", "Q1 2026", "Q2 2026", ], series: [{ name: "New business (£m)" }, { name: "Renewals (£m)" }, { name: "Expansion (£m)" }, { name: "Services (£m)" }], values: [ [1.8, 2.4, 0.4, 0.3], [2.0, 2.6, 0.5, 0.4], [2.1, 2.8, 0.5, 0.4], [2.3, 2.9, 0.6, 0.5], [2.4, 3.1, 0.7, 0.5], [2.8, 3.3, 0.9, 0.6], [3.2, 3.5, 1.0, 0.7], [3.9, 3.8, 1.2, 0.8], [3.6, 4.1, 1.4, 0.9], [4.3, 4.4, 1.6, 1.1], ], ariaLabel: "Quarterly recurring revenue from new business, renewals, expansion, and services in millions of pounds", tooltip: true, legend: true,}; import { StackedBarChart } from "@grassroot/charts-react"; export default function StackedBarChartDemo() { return ( <div> <StackedBarChart {...stackedBarChartFixture} /> </div> );}- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script setup lang="ts">const stackedBarChartFixture = { id: "stacked-bar-chart", labels: [ "Q1 2024", "Q2 2024", "Q3 2024", "Q4 2024", "Q1 2025", "Q2 2025", "Q3 2025", "Q4 2025", "Q1 2026", "Q2 2026", ], series: [{ name: "New business (£m)" }, { name: "Renewals (£m)" }, { name: "Expansion (£m)" }, { name: "Services (£m)" }], values: [ [1.8, 2.4, 0.4, 0.3], [2.0, 2.6, 0.5, 0.4], [2.1, 2.8, 0.5, 0.4], [2.3, 2.9, 0.6, 0.5], [2.4, 3.1, 0.7, 0.5], [2.8, 3.3, 0.9, 0.6], [3.2, 3.5, 1.0, 0.7], [3.9, 3.8, 1.2, 0.8], [3.6, 4.1, 1.4, 0.9], [4.3, 4.4, 1.6, 1.1], ], ariaLabel: "Quarterly recurring revenue from new business, renewals, expansion, and services in millions of pounds", tooltip: true, legend: true,}; import { StackedBarChart } from "@grassroot/charts-vue";</script><template><StackedBarChart v-bind="stackedBarChartFixture" /></template>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";const stackedBarChartFixture = { id: "stacked-bar-chart", labels: [ "Q1 2024", "Q2 2024", "Q3 2024", "Q4 2024", "Q1 2025", "Q2 2025", "Q3 2025", "Q4 2025", "Q1 2026", "Q2 2026", ], series: [{ name: "New business (£m)" }, { name: "Renewals (£m)" }, { name: "Expansion (£m)" }, { name: "Services (£m)" }], values: [ [1.8, 2.4, 0.4, 0.3], [2.0, 2.6, 0.5, 0.4], [2.1, 2.8, 0.5, 0.4], [2.3, 2.9, 0.6, 0.5], [2.4, 3.1, 0.7, 0.5], [2.8, 3.3, 0.9, 0.6], [3.2, 3.5, 1.0, 0.7], [3.9, 3.8, 1.2, 0.8], [3.6, 4.1, 1.4, 0.9], [4.3, 4.4, 1.6, 1.1], ], ariaLabel: "Quarterly recurring revenue from new business, renewals, expansion, and services in millions of pounds", tooltip: true, legend: true,}; import { GrassrootStackedBarChart } from "@grassroot/charts-angular";@Component({ selector: "app-stacked-bar-chart-chart-demo", standalone: true, imports: [GrassrootStackedBarChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-stacked-bar-chart [labels]="fixture.labels" [series]="fixture.series" [values]="fixture.values" [ariaLabel]="fixture.ariaLabel" [tooltip]="fixture.tooltip" [legend]="fixture.legend" />`,})export class StackedBarChartDemoComponent { readonly fixture = stackedBarChartFixture;}export default StackedBarChartDemoComponent;- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script lang="ts"> const stackedBarChartFixture = { id: "stacked-bar-chart", labels: [ "Q1 2024", "Q2 2024", "Q3 2024", "Q4 2024", "Q1 2025", "Q2 2025", "Q3 2025", "Q4 2025", "Q1 2026", "Q2 2026", ], series: [{ name: "New business (£m)" }, { name: "Renewals (£m)" }, { name: "Expansion (£m)" }, { name: "Services (£m)" }], values: [ [1.8, 2.4, 0.4, 0.3], [2.0, 2.6, 0.5, 0.4], [2.1, 2.8, 0.5, 0.4], [2.3, 2.9, 0.6, 0.5], [2.4, 3.1, 0.7, 0.5], [2.8, 3.3, 0.9, 0.6], [3.2, 3.5, 1.0, 0.7], [3.9, 3.8, 1.2, 0.8], [3.6, 4.1, 1.4, 0.9], [4.3, 4.4, 1.6, 1.1], ], ariaLabel: "Quarterly recurring revenue from new business, renewals, expansion, and services in millions of pounds", tooltip: true, legend: true, }; import { StackedBarChart } from "@grassroot/charts-svelte";</script> <StackedBarChart {...stackedBarChartFixture} />- surface
- —
- marks
- —
- size
- —
- value
- —
ts
/** @jsxImportSource solid-js */const stackedBarChartFixture = { id: "stacked-bar-chart", labels: [ "Q1 2024", "Q2 2024", "Q3 2024", "Q4 2024", "Q1 2025", "Q2 2025", "Q3 2025", "Q4 2025", "Q1 2026", "Q2 2026", ], series: [{ name: "New business (£m)" }, { name: "Renewals (£m)" }, { name: "Expansion (£m)" }, { name: "Services (£m)" }], values: [ [1.8, 2.4, 0.4, 0.3], [2.0, 2.6, 0.5, 0.4], [2.1, 2.8, 0.5, 0.4], [2.3, 2.9, 0.6, 0.5], [2.4, 3.1, 0.7, 0.5], [2.8, 3.3, 0.9, 0.6], [3.2, 3.5, 1.0, 0.7], [3.9, 3.8, 1.2, 0.8], [3.6, 4.1, 1.4, 0.9], [4.3, 4.4, 1.6, 1.1], ], ariaLabel: "Quarterly recurring revenue from new business, renewals, expansion, and services in millions of pounds", tooltip: true, legend: true,}; import { StackedBarChart } from "@grassroot/charts-solid";export default function StackedBarChartDemo() { return <StackedBarChart {...stackedBarChartFixture} />;}Installation
API Reference
Import
import { StackedBarChart } from "@grassroot/charts-react";
Props
Prop
Type
Default
Requirement
Description
labelsstring[]—
required
—
seriesStackedBarSeriesDatum[]—
required
—
valuesnumber[][]—
required
—
maxnumber | undefined—
optional
—
legendboolean | LegendConfig | undefined—
optional
—
tooltipboolean | undefined—
optional
—
interactiveboolean | undefined—
optional
—
speednumber | undefined—
optional
Playback-speed multiplier for entrance/ambient motion.
morphDurationMsnumber | undefined—
optional
How long a dataset change tweens, in ms.
replayTokenstring | number | undefined—
optional
Changing this value replays the entrance animation.
rendererimport("@grassroot/core").ChartRenderer | undefined—
optional
—
classNamestring | undefined—
optional
—
themeimport("@grassroot/theme").PartialChartTheme | undefined—
optional
—
animationimport("@grassroot/theme").ChartAnimationInput | undefined—
optional
—
- Prop
series- Type
StackedBarSeriesDatum[]- Default
- —
- Requirement
- required
- Description
- —
- Prop
values- Type
number[][]- Default
- —
- Requirement
- required
- Description
- —
- Prop
max- Type
number | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
legend- Type
boolean | LegendConfig | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
tooltip- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
interactive- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
speed- Type
number | undefined- Default
- —
- Requirement
- optional
- Description
- Playback-speed multiplier for entrance/ambient motion.
- Prop
morphDurationMs- Type
number | undefined- Default
- —
- Requirement
- optional
- Description
- How long a dataset change tweens, in ms.
- Prop
replayToken- Type
string | number | undefined- Default
- —
- Requirement
- optional
- Description
- Changing this value replays the entrance animation.
- Prop
renderer- Type
import("@grassroot/core").ChartRenderer | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
theme- Type
import("@grassroot/theme").PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
animation- Type
import("@grassroot/theme").ChartAnimationInput | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
keyboardNavigation- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Description
- —
Content regions
childrendataSummary
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { StackedBarChart } from "@grassroot/charts-vue";
Props
Prop
Type
Default
Requirement
labelsreadonly string[]—
required
seriesreadonly StackedBarSeriesDatum[]—
required
valuesreadonly (readonly number[])[]—
required
maxnumber | undefined—
optional
rendererChartRenderer | undefined"svg"optional
ariaLabelstring | undefined—
optional
classNamestring | undefined—
optional
titlestring | undefined—
optional
descriptionstring | undefined—
optional
themePartialChartTheme | undefined—
optional
animationChartAnimationInput | undefined—
optional
legendboolean | LegendConfig | undefinedfalseoptional
interactiveboolean | undefinedtrueoptional
tooltipboolean | undefinedtrueoptional
- Prop
labels- Type
readonly string[]- Default
- —
- Requirement
- required
- Prop
series- Type
readonly StackedBarSeriesDatum[]- Default
- —
- Requirement
- required
- Prop
values- Type
readonly (readonly number[])[]- Default
- —
- Requirement
- required
- Prop
max- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer | undefined- Default
"svg"- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput | undefined- Default
- —
- Requirement
- optional
- Prop
legend- Type
boolean | LegendConfig | undefined- Default
false- Requirement
- optional
- Prop
interactive- Type
boolean | undefined- Default
true- Requirement
- optional
- Prop
tooltip- Type
boolean | undefined- Default
true- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean | undefined- Default
true- Requirement
- optional
- Prop
speed- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
morphDurationMs- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
replayToken- Type
string | number | undefined- Default
- —
- Requirement
- optional
Content regions
dataSummarydefault
Import
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootStackedBarChart } from "@grassroot/charts-angular";
Props
Prop
Type
Default
Requirement
labelsreadonly string[]—
required
seriesreadonly StackedBarSeriesDatum[]—
required
valuesreadonly (readonly number[])[]—
required
maxnumber—
optional
rendererChartRenderer—
optional
speednumber—
optional
morphDurationMsnumber—
optional
replayTokenstring | number—
optional
ariaLabelstring—
optional
classNamestring—
optional
titlestring—
optional
descriptionstring—
optional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
- Prop
labels- Type
readonly string[]- Default
- —
- Requirement
- required
- Prop
series- Type
readonly StackedBarSeriesDatum[]- Default
- —
- Requirement
- required
- Prop
values- Type
readonly (readonly number[])[]- Default
- —
- Requirement
- required
- Prop
max- Type
number- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
speed- Type
number- Default
- —
- Requirement
- optional
- Prop
morphDurationMs- Type
number- Default
- —
- Requirement
- optional
- Prop
replayToken- Type
string | number- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
interactive- Type
boolean- Default
true- Requirement
- optional
- Prop
tooltip- Type
boolean- Default
true- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
true- Requirement
- optional
- Prop
legend- Type
boolean | LegendConfig- Default
false- Requirement
- optional
Content regions
childrendataSummary
Import
import { StackedBarChart } from "@grassroot/charts-svelte";
Props
Prop
Type
Default
Requirement
labelsreadonly string[]—
required
seriesreadonly StackedBarSeriesDatum[]—
required
valuesreadonly (readonly number[])[]—
required
maxnumber—
optional
rendererChartRenderer"svg"optional
ariaLabelstring—
optional
titlestring—
optional
descriptionstring—
optional
interactivebooleantrueoptional
tooltipbooleantrueoptional
legendboolean | LegendConfigfalseoptional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
- Prop
labels- Type
readonly string[]- Default
- —
- Requirement
- required
- Prop
series- Type
readonly StackedBarSeriesDatum[]- Default
- —
- Requirement
- required
- Prop
values- Type
readonly (readonly number[])[]- Default
- —
- Requirement
- required
- Prop
max- Type
number- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
"svg"- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
true- Requirement
- optional
- Prop
interactive- Type
boolean- Default
true- Requirement
- optional
- Prop
tooltip- Type
boolean- Default
true- Requirement
- optional
- Prop
legend- Type
boolean | LegendConfig- Default
false- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
speed- Type
number- Default
- —
- Requirement
- optional
- Prop
morphDurationMs- Type
number- Default
- —
- Requirement
- optional
- Prop
replayToken- Type
string | number- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
- Prop
style- Type
string- Default
- —
- Requirement
- optional
Content regions
childrendataSummary
Import
import { StackedBarChart } from "@grassroot/charts-solid";
Props
Prop
Type
Default
Requirement
labelsreadonly string[]—
required
seriesreadonly StackedBarSeriesDatum[]—
required
valuesreadonly (readonly number[])[]—
required
maxnumber—
optional
rendererChartRenderer"svg"optional
ariaLabelstring—
optional
legendboolean | LegendConfig—
optional
titlestring—
optional
descriptionstring—
optional
interactivebooleantrueoptional
tooltipboolean—
optional
themePartialChartTheme—
optional
animationChartAnimationInput—
optional
- Prop
labels- Type
readonly string[]- Default
- —
- Requirement
- required
- Prop
series- Type
readonly StackedBarSeriesDatum[]- Default
- —
- Requirement
- required
- Prop
values- Type
readonly (readonly number[])[]- Default
- —
- Requirement
- required
- Prop
max- Type
number- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
"svg"- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
legend- Type
boolean | LegendConfig- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
true- Requirement
- optional
- Prop
interactive- Type
boolean- Default
true- Requirement
- optional
- Prop
tooltip- Type
boolean- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
speed- Type
number- Default
- —
- Requirement
- optional
- Prop
morphDurationMs- Type
number- Default
- —
- Requirement
- optional
- Prop
replayToken- Type
string | number- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
- Prop
style- Type
JSX.CSSProperties- Default
- —
- Requirement
- optional
Content regions
childrendataSummary