Docs Charts Core charts

BarChart

React example follows below.
ts
const barChartFixture = {
id: "bar-chart",
data: [
{ label: "Organic", value: 1842 },
{ label: "Paid search", value: 1376 },
{ label: "Direct", value: 1128 },
{ label: "Partners", value: 746 },
{ label: "Referrals", value: 512 },
{ label: "Email", value: 468 },
{ label: "Social", value: 391 },
{ label: "Affiliate", value: 274 },
{ label: "Display", value: 218 },
{ label: "Events", value: 164 },
{ label: "Podcast", value: 121 },
{ label: "Community", value: 86 },
],
max: 2000,
ariaLabel: "Qualified leads by acquisition channel, Q2 2026",
animation: { durationMs: 520, staggerMs: 48 },
tooltip: true,
legend: { position: "top" },
} satisfies {
id: string;
data: Array<{ label: string; value: number }>;
max: number;
ariaLabel: string;
animation: { durationMs: number; staggerMs: number };
tooltip: boolean;
legend: { position: "top" | "bottom" | "left" | "right" };
};
import { BarChart } from "@grassroot/charts-react";
export default function BarChartDemo() {
return (
<div>
<BarChart {...barChartFixture} />
</div>
);
}
ts
<script setup lang="ts">
const barChartFixture = {
id: "bar-chart",
data: [
{ label: "Organic", value: 1842 },
{ label: "Paid search", value: 1376 },
{ label: "Direct", value: 1128 },
{ label: "Partners", value: 746 },
{ label: "Referrals", value: 512 },
{ label: "Email", value: 468 },
{ label: "Social", value: 391 },
{ label: "Affiliate", value: 274 },
{ label: "Display", value: 218 },
{ label: "Events", value: 164 },
{ label: "Podcast", value: 121 },
{ label: "Community", value: 86 },
],
max: 2000,
ariaLabel: "Qualified leads by acquisition channel, Q2 2026",
animation: { durationMs: 520, staggerMs: 48 },
tooltip: true,
legend: { position: "top" },
} satisfies {
id: string;
data: Array<{ label: string; value: number }>;
max: number;
ariaLabel: string;
animation: { durationMs: number; staggerMs: number };
tooltip: boolean;
legend: { position: "top" | "bottom" | "left" | "right" };
};
import { BarChart } from "@grassroot/charts-vue";
</script>
<template><BarChart v-bind="barChartFixture" /></template>
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";
const barChartFixture = {
id: "bar-chart",
data: [
{ label: "Organic", value: 1842 },
{ label: "Paid search", value: 1376 },
{ label: "Direct", value: 1128 },
{ label: "Partners", value: 746 },
{ label: "Referrals", value: 512 },
{ label: "Email", value: 468 },
{ label: "Social", value: 391 },
{ label: "Affiliate", value: 274 },
{ label: "Display", value: 218 },
{ label: "Events", value: 164 },
{ label: "Podcast", value: 121 },
{ label: "Community", value: 86 },
],
max: 2000,
ariaLabel: "Qualified leads by acquisition channel, Q2 2026",
animation: { durationMs: 520, staggerMs: 48 },
tooltip: true,
legend: { position: "top" },
} satisfies {
id: string;
data: Array<{ label: string; value: number }>;
max: number;
ariaLabel: string;
animation: { durationMs: number; staggerMs: number };
tooltip: boolean;
legend: { position: "top" | "bottom" | "left" | "right" };
};
import { GrassrootBarChart } from "@grassroot/charts-angular";
@Component({
selector: "app-bar-chart-chart-demo",
standalone: true,
imports: [GrassrootBarChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<grassroot-bar-chart
[data]="fixture.data"
[max]="fixture.max"
[ariaLabel]="fixture.ariaLabel"
[animation]="fixture.animation"
[tooltip]="fixture.tooltip"
[legend]="fixture.legend"
/>`,
})
export class BarChartDemoComponent {
readonly fixture = barChartFixture;
}
export default BarChartDemoComponent;
ts
<script lang="ts">
const barChartFixture = {
id: "bar-chart",
data: [
{ label: "Organic", value: 1842 },
{ label: "Paid search", value: 1376 },
{ label: "Direct", value: 1128 },
{ label: "Partners", value: 746 },
{ label: "Referrals", value: 512 },
{ label: "Email", value: 468 },
{ label: "Social", value: 391 },
{ label: "Affiliate", value: 274 },
{ label: "Display", value: 218 },
{ label: "Events", value: 164 },
{ label: "Podcast", value: 121 },
{ label: "Community", value: 86 },
],
max: 2000,
ariaLabel: "Qualified leads by acquisition channel, Q2 2026",
animation: { durationMs: 520, staggerMs: 48 },
tooltip: true,
legend: { position: "top" },
} satisfies {
id: string;
data: Array<{ label: string; value: number }>;
max: number;
ariaLabel: string;
animation: { durationMs: number; staggerMs: number };
tooltip: boolean;
legend: { position: "top" | "bottom" | "left" | "right" };
};
import { BarChart } from "@grassroot/charts-svelte";
</script>
<BarChart {...barChartFixture} />
ts
/** @jsxImportSource solid-js */
const barChartFixture = {
id: "bar-chart",
data: [
{ label: "Organic", value: 1842 },
{ label: "Paid search", value: 1376 },
{ label: "Direct", value: 1128 },
{ label: "Partners", value: 746 },
{ label: "Referrals", value: 512 },
{ label: "Email", value: 468 },
{ label: "Social", value: 391 },
{ label: "Affiliate", value: 274 },
{ label: "Display", value: 218 },
{ label: "Events", value: 164 },
{ label: "Podcast", value: 121 },
{ label: "Community", value: 86 },
],
max: 2000,
ariaLabel: "Qualified leads by acquisition channel, Q2 2026",
animation: { durationMs: 520, staggerMs: 48 },
tooltip: true,
legend: { position: "top" },
} satisfies {
id: string;
data: Array<{ label: string; value: number }>;
max: number;
ariaLabel: string;
animation: { durationMs: number; staggerMs: number };
tooltip: boolean;
legend: { position: "top" | "bottom" | "left" | "right" };
};
import { BarChart } from "@grassroot/charts-solid";
export default function BarChartDemo() {
return <BarChart {...barChartFixture} />;
}

Installation

API Reference

Import

import { BarChart } from "@grassroot/charts-react";

Props

Prop
Type
Default
Requirement
Description
data
ChartCategoricalDatum[]
required
max
number | undefined
optional
color
string | undefined
optional
yDomain
ChartNumericDomain | undefined
optional
xAxis
ChartAxisOptions<string> | undefined
optional
yAxis
ChartAxisOptions<number> | undefined
optional
showGrid
boolean | undefined
optional
formatXTick
((value: string, index: number) => string) | undefined
optional
formatYTick
((value: number, index: number) => string) | undefined
optional
mode
"bar" | "waveform" | undefined
optional
playhead
number | 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.
Prop
data
Type
ChartCategoricalDatum[]
Default
Requirement
required
Description
Prop
max
Type
number | undefined
Default
Requirement
optional
Description
Prop
color
Type
string | undefined
Default
Requirement
optional
Description
Prop
yDomain
Type
ChartNumericDomain | undefined
Default
Requirement
optional
Description
Prop
xAxis
Type
ChartAxisOptions<string> | undefined
Default
Requirement
optional
Description
Prop
yAxis
Type
ChartAxisOptions<number> | undefined
Default
Requirement
optional
Description
Prop
showGrid
Type
boolean | undefined
Default
Requirement
optional
Description
Prop
formatXTick
Type
((value: string, index: number) => string) | undefined
Default
Requirement
optional
Description
Prop
formatYTick
Type
((value: number, index: number) => string) | undefined
Default
Requirement
optional
Description
Prop
mode
Type
"bar" | "waveform" | undefined
Default
Requirement
optional
Description
Prop
playhead
Type
number | 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
Prop
interactive
Type
boolean | undefined
Default
Requirement
optional
Description
Prop
tooltip
Type
boolean | import("../../types").TooltipConfig<ChartCategoricalDatum> | undefined
Default
Requirement
optional
Description
Prop
crosshair
Type
boolean | import("../../types").CrosshairConfig | undefined
Default
Requirement
optional
Description
Prop
legend
Type
boolean | LegendConfig | undefined
Default
Requirement
optional
Description
Prop
activePoint
Type
ActivePoint<ChartCategoricalDatum> | null | undefined
Default
Requirement
optional
Description
Prop
defaultActivePoint
Type
ActivePoint<ChartCategoricalDatum> | null | undefined
Default
Requirement
optional
Description
Prop
onActivePointChange
Type
((point: ActivePoint<ChartCategoricalDatum> | null) => void) | undefined
Default
Requirement
optional
Description
Prop
hiddenSeries
Type
readonly string[] | undefined
Default
Requirement
optional
Description
Prop
defaultHiddenSeries
Type
readonly string[] | undefined
Default
Requirement
optional
Description
Prop
onHiddenSeriesChange
Type
((hidden: readonly string[]) => void) | undefined
Default
Requirement
optional
Description

Events

EventPayload
onActivePointChange((point: ActivePoint<ChartCategoricalDatum> | null) => void) | undefined
onHiddenSeriesChange((hidden: readonly string[]) => void) | undefined

Content regions

  • children
  • dataSummary

Native attributes

Standard DOM and ARIA attributes not listed above spread onto the root element.

Import

import { BarChart } from "@grassroot/charts-vue";

Props

Prop
Type
Default
Requirement
data
readonly BarDatum[]
required
max
number | undefined
optional
color
string | undefined
optional
yDomain
readonly [number, number] | undefined
optional
xAxis
ChartAxisOptions<string> | undefined
optional
yAxis
ChartAxisOptions<number> | undefined
optional
showGrid
boolean | undefined
false
optional
formatXTick
((value: string, index: number) => string) | undefined
optional
formatYTick
((value: number, index: number) => string) | undefined
optional
mode
"bar" | "waveform" | undefined
optional
playhead
number | undefined
optional
renderer
ChartRenderer | undefined
optional
ariaLabel
string | undefined
optional
className
string | undefined
optional
Prop
data
Type
readonly BarDatum[]
Default
Requirement
required
Prop
max
Type
number | undefined
Default
Requirement
optional
Prop
color
Type
string | undefined
Default
Requirement
optional
Prop
yDomain
Type
readonly [number, number] | undefined
Default
Requirement
optional
Prop
xAxis
Type
ChartAxisOptions<string> | undefined
Default
Requirement
optional
Prop
yAxis
Type
ChartAxisOptions<number> | undefined
Default
Requirement
optional
Prop
showGrid
Type
boolean | undefined
Default
false
Requirement
optional
Prop
formatXTick
Type
((value: string, index: number) => string) | undefined
Default
Requirement
optional
Prop
formatYTick
Type
((value: number, index: number) => string) | undefined
Default
Requirement
optional
Prop
mode
Type
"bar" | "waveform" | undefined
Default
Requirement
optional
Prop
playhead
Type
number | undefined
Default
Requirement
optional
Prop
renderer
Type
ChartRenderer | undefined
Default
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
interactive
Type
boolean | undefined
Default
true
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig | undefined
Default
true
Requirement
optional
Prop
keyboardNavigation
Type
boolean | undefined
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig | undefined
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig | undefined
Default
false
Requirement
optional
Prop
hiddenSeries
Type
readonly string[] | undefined
Default
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[] | undefined
Default
() => []
Requirement
optional
Prop
activePoint
Type
ActivePoint<BarDatum> | null | undefined
Default
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<BarDatum> | null | undefined
Default
null
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

Events

EventPayload
activePointChange[point: ActivePoint<BarDatum> | null]
hiddenSeriesChange[ids: readonly string[]]

Content regions

  • dataSummary
  • default

Import

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

Props

Prop
Type
Default
Requirement
renderer
ChartRenderer
optional
gpuBackend
ChartGpuBackend
optional
rendererStrategy
Partial<ChartRendererStrategy>
optional
renderPlanMode
"svg" | "host"
"host"
optional
ariaLabel
string
optional
title
string
optional
description
string
optional
theme
PartialChartTheme
optional
animation
ChartAnimationInput
optional
interactive
boolean
true
optional
keyboardNavigation
boolean
true
optional
tooltip
boolean | TooltipBehaviorConfig
true
optional
legend
boolean | LegendConfig
optional
hiddenSeries
readonly string[]
optional
Prop
renderer
Type
ChartRenderer
Default
Requirement
optional
Prop
gpuBackend
Type
ChartGpuBackend
Default
Requirement
optional
Prop
rendererStrategy
Type
Partial<ChartRendererStrategy>
Default
Requirement
optional
Prop
renderPlanMode
Type
"svg" | "host"
Default
"host"
Requirement
optional
Prop
ariaLabel
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
keyboardNavigation
Type
boolean
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
[]
Requirement
optional
Prop
activeDatum
Type
string | null
Default
Requirement
optional
Prop
defaultActiveDatum
Type
string | null
Default
null
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
data
Type
readonly BarDatum[]
Default
Requirement
required
Prop
max
Type
number
Default
Requirement
optional
Prop
color
Type
string
Default
Requirement
optional
Prop
yDomain
Type
readonly [number, number]
Default
Requirement
optional
Prop
xAxis
Type
ChartAxisOptions<string>
Default
Requirement
optional
Prop
yAxis
Type
ChartAxisOptions<number>
Default
Requirement
optional
Prop
showGrid
Type
boolean
Default
false
Requirement
optional
Prop
formatXTick
Type
(value: string, index: number) => string
Default
Requirement
optional
Prop
formatYTick
Type
(value: number, index: number) => string
Default
Requirement
optional
Prop
mode
Type
BarChartOptions["mode"]
Default
Requirement
optional
Prop
playhead
Type
number
Default
Requirement
optional
Prop
className
Type
string
Default
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
activePoint
Type
ActivePoint<BarDatum> | null
Default
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<BarDatum> | null
Default
null
Requirement
optional

Events

EventPayload
activeDatumChangestring | null
hiddenSeriesChangereadonly string[]
activePointChangeActivePoint<BarDatum> | null

Content regions

  • dataSummary
  • default

Import

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

Props

Prop
Type
Default
Requirement
data
readonly BarDatum[]
required
max
number
optional
color
string
optional
yDomain
readonly [number, number]
optional
xAxis
BarChartOptions["xAxis"]
optional
yAxis
BarChartOptions["yAxis"]
optional
showGrid
boolean
optional
formatXTick
BarChartOptions["formatXTick"]
optional
formatYTick
BarChartOptions["formatYTick"]
optional
mode
BarChartOptions["mode"]
optional
playhead
number
optional
renderer
ChartRenderer
optional
ariaLabel
string
optional
title
string
optional
Prop
data
Type
readonly BarDatum[]
Default
Requirement
required
Prop
max
Type
number
Default
Requirement
optional
Prop
color
Type
string
Default
Requirement
optional
Prop
yDomain
Type
readonly [number, number]
Default
Requirement
optional
Prop
xAxis
Type
BarChartOptions["xAxis"]
Default
Requirement
optional
Prop
yAxis
Type
BarChartOptions["yAxis"]
Default
Requirement
optional
Prop
showGrid
Type
boolean
Default
Requirement
optional
Prop
formatXTick
Type
BarChartOptions["formatXTick"]
Default
Requirement
optional
Prop
formatYTick
Type
BarChartOptions["formatYTick"]
Default
Requirement
optional
Prop
mode
Type
BarChartOptions["mode"]
Default
Requirement
optional
Prop
playhead
Type
number
Default
Requirement
optional
Prop
renderer
Type
ChartRenderer
Default
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
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
true
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
false
Requirement
optional
Prop
activePoint
Type
ActivePoint<BarDatum> | null
Default
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<BarDatum> | null
Default
null
Requirement
optional
Prop
onActivePointChange
Type
(point: ActivePoint<BarDatum> | null) => void
Default
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
Requirement
optional
Prop
onHiddenSeriesChange
Type
(ids: readonly string[]) => void
Default
Requirement
optional
Prop
theme
Type
PartialChartTheme
Default
Requirement
optional
Prop
animation
Type
ChartAnimationInput
Default
Requirement
optional
Prop
class
Type
string
Default
Requirement
optional
Prop
style
Type
string
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

Events

EventPayload
onActivePointChange(point: ActivePoint<BarDatum> | null) => void
onHiddenSeriesChange(ids: readonly string[]) => void

Content regions

  • children
  • dataSummary

Import

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

Props

Prop
Type
Default
Requirement
data
readonly BarDatum[]
required
max
number
optional
color
string
optional
yDomain
readonly [number, number]
optional
xAxis
ChartAxisOptions<string>
optional
yAxis
ChartAxisOptions<number>
optional
showGrid
boolean
optional
formatXTick
(value: string, index: number) => string
optional
formatYTick
(value: number, index: number) => string
optional
mode
BarChartOptions["mode"]
optional
playhead
number
optional
renderer
ChartRenderer
optional
ariaLabel
string
optional
interactive
boolean
optional
Prop
data
Type
readonly BarDatum[]
Default
Requirement
required
Prop
max
Type
number
Default
Requirement
optional
Prop
color
Type
string
Default
Requirement
optional
Prop
yDomain
Type
readonly [number, number]
Default
Requirement
optional
Prop
xAxis
Type
ChartAxisOptions<string>
Default
Requirement
optional
Prop
yAxis
Type
ChartAxisOptions<number>
Default
Requirement
optional
Prop
showGrid
Type
boolean
Default
Requirement
optional
Prop
formatXTick
Type
(value: string, index: number) => string
Default
Requirement
optional
Prop
formatYTick
Type
(value: number, index: number) => string
Default
Requirement
optional
Prop
mode
Type
BarChartOptions["mode"]
Default
Requirement
optional
Prop
playhead
Type
number
Default
Requirement
optional
Prop
renderer
Type
ChartRenderer
Default
Requirement
optional
Prop
ariaLabel
Type
string
Default
Requirement
optional
Prop
interactive
Type
boolean
Default
Requirement
optional
Prop
crosshair
Type
boolean | CrosshairBehaviorConfig
Default
true
Requirement
optional
Prop
tooltip
Type
boolean | TooltipBehaviorConfig
Default
Requirement
optional
Prop
legend
Type
boolean | LegendConfig
Default
Requirement
optional
Prop
activePoint
Type
ActivePoint<BarDatum> | null
Default
Requirement
optional
Prop
defaultActivePoint
Type
ActivePoint<BarDatum> | null
Default
null
Requirement
optional
Prop
onActivePointChange
Type
(point: ActivePoint<BarDatum> | null) => void
Default
Requirement
optional
Prop
hiddenSeries
Type
readonly string[]
Default
Requirement
optional
Prop
defaultHiddenSeries
Type
readonly string[]
Default
Requirement
optional
Prop
onHiddenSeriesChange
Type
(ids: readonly string[]) => void
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
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

Events

EventPayload
onActivePointChange(point: ActivePoint<BarDatum> | null) => void
onHiddenSeriesChange(ids: readonly string[]) => void

Content regions

  • children
  • dataSummary