DocsChartsCore charts
BarChart
React example follows below.
ts
import { BarChart } from "@grassroot/charts-react"; <BarChart animation={{ durationMs: 520, staggerMs: 48 }} ariaLabel="Requests by region, last 7 days" tooltip legend={{ position: "top" }} data={[{ label: "us-east", value: 82 }, { label: "us-west", value: 64 }]} max={90} />ts
<script setup lang="ts">import { BarChart } from "@grassroot/charts-vue";</script> <template> <BarChart :animation='{ durationMs: 520, staggerMs: 48 }' ariaLabel="Requests by region, last 7 days" tooltip :legend='{ position: "top" }' :data='[{ label: "us-east", value: 82 }, { label: "us-west", value: 64 }]' :max='90' /></template>ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootBarChart } from "@grassroot/charts-angular"; @Component({ selector: "app-bar-chart-chart-demo", standalone: true, imports: [GrassrootBarChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-bar-chart [animation]='{ durationMs: 520, staggerMs: 48 }' ariaLabel="Requests by region, last 7 days" tooltip [legend]='{ position: "top" }' [data]='[{ label: "us-east", value: 82 }, { label: "us-west", value: 64 }]' [max]='90' />`,})export class BarChartDemoComponent { } export default BarChartDemoComponent;ts
<script lang="ts"> import { BarChart } from "@grassroot/charts-svelte";</script> <BarChart animation={{ durationMs: 520, staggerMs: 48 }} ariaLabel="Requests by region, last 7 days" tooltip legend={{ position: "top" }} data={[{ label: "us-east", value: 82 }, { label: "us-west", value: 64 }]} max={90} />ts
/** @jsxImportSource solid-js */import { BarChart } from "@grassroot/charts-solid"; export default function BarChartDemo() { return <BarChart animation={{ durationMs: 520, staggerMs: 48 }} ariaLabel="Requests by region, last 7 days" tooltip legend={{ position: "top" }} data={[{ label: "us-east", value: 82 }, { label: "us-west", value: 64 }]} max={90} />;}Installation
bash
pnpm dlx grassroot add chart/bar-chartbash
npx grassroot@latest add chart/bar-chartbash
yarn dlx grassroot add chart/bar-chartbash
bunx grassroot add chart/bar-chartAPI Reference
| Prop | Type | Default |
|---|---|---|
datarequired | ChartCategoricalDatum[] | — |
max | number | undefined | — |
color | string | undefined | — |
yDomain | ChartNumericDomain | undefined | — |
xAxis | ChartAxisOptions<string> | undefined | — |
yAxis | ChartAxisOptions<number> | undefined | — |
showGrid | boolean | undefined | — |
formatXTick | ((value: string, index: number) => string) | undefined | — |
formatYTick | ((value: number, index: number) => string) | undefined | — |