Docs Charts Core charts

StackedBarChart

React example follows below.
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>
);
}
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>
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;
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} />
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
labels
string[]
required
series
StackedBarSeriesDatum[]
required
values
number[][]
required
max
number | undefined
optional
legend
boolean | LegendConfig | undefined
optional
tooltip
boolean | undefined
optional
interactive
boolean | undefined
optional
speed
number | undefined
optional
Playback-speed multiplier for entrance/ambient motion.
morphDurationMs
number | undefined
optional
How long a dataset change tweens, in ms.
replayToken
string | number | undefined
optional
Changing this value replays the entrance animation.
renderer
import("@grassroot/core").ChartRenderer | undefined
optional
className
string | undefined
optional
theme
import("@grassroot/theme").PartialChartTheme | undefined
optional
animation
import("@grassroot/theme").ChartAnimationInput | undefined
optional
Prop
labels
Type
string[]
Default
Requirement
required
Description
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

  • children
  • dataSummary

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
labels
readonly string[]
required
series
readonly StackedBarSeriesDatum[]
required
values
readonly (readonly number[])[]
required
max
number | undefined
optional
renderer
ChartRenderer | undefined
"svg"
optional
ariaLabel
string | undefined
optional
className
string | undefined
optional
title
string | undefined
optional
description
string | undefined
optional
theme
PartialChartTheme | undefined
optional
animation
ChartAnimationInput | undefined
optional
legend
boolean | LegendConfig | undefined
false
optional
interactive
boolean | undefined
true
optional
tooltip
boolean | undefined
true
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 | 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

  • dataSummary
  • default

Import

import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootStackedBarChart } from "@grassroot/charts-angular";

Props

Prop
Type
Default
Requirement
labels
readonly string[]
required
series
readonly StackedBarSeriesDatum[]
required
values
readonly (readonly number[])[]
required
max
number
optional
renderer
ChartRenderer
optional
speed
number
optional
morphDurationMs
number
optional
replayToken
string | number
optional
ariaLabel
string
optional
className
string
optional
title
string
optional
description
string
optional
theme
PartialChartTheme
optional
animation
ChartAnimationInput
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

  • children
  • dataSummary

Import

import { StackedBarChart } from "@grassroot/charts-svelte";

Props

Prop
Type
Default
Requirement
labels
readonly string[]
required
series
readonly StackedBarSeriesDatum[]
required
values
readonly (readonly number[])[]
required
max
number
optional
renderer
ChartRenderer
"svg"
optional
ariaLabel
string
optional
title
string
optional
description
string
optional
keyboardNavigation
boolean
true
optional
interactive
boolean
true
optional
tooltip
boolean
true
optional
legend
boolean | LegendConfig
false
optional
theme
PartialChartTheme
optional
animation
ChartAnimationInput
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

  • children
  • dataSummary

Import

import { StackedBarChart } from "@grassroot/charts-solid";

Props

Prop
Type
Default
Requirement
labels
readonly string[]
required
series
readonly StackedBarSeriesDatum[]
required
values
readonly (readonly number[])[]
required
max
number
optional
renderer
ChartRenderer
"svg"
optional
ariaLabel
string
optional
legend
boolean | LegendConfig
optional
title
string
optional
description
string
optional
keyboardNavigation
boolean
true
optional
interactive
boolean
true
optional
tooltip
boolean
optional
theme
PartialChartTheme
optional
animation
ChartAnimationInput
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

  • children
  • dataSummary