DocsChartsCore charts
AreaChart
React example follows below.
ts
import { AreaChart } from "@grassroot/charts-react"; const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; <AreaChart animation={{ durationMs: 640, staggerMs: 32 }} ariaLabel="Cumulative signups, year to date" tooltip crosshair legend={{ position: "top" }} data={[5, 9, 14, 18, 26, 33, 39, 48, 57, 63, 72, 80]} labels={monthLabels} max={88} />ts
<script setup lang="ts">import { AreaChart } from "@grassroot/charts-vue"; const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];</script> <template> <AreaChart :animation='{ durationMs: 640, staggerMs: 32 }' ariaLabel="Cumulative signups, year to date" tooltip crosshair :legend='{ position: "top" }' :data='[5, 9, 14, 18, 26, 33, 39, 48, 57, 63, 72, 80]' :labels='monthLabels' :max='88' /></template>ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootAreaChart } from "@grassroot/charts-angular"; @Component({ selector: "app-area-chart-chart-demo", standalone: true, imports: [GrassrootAreaChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-area-chart [animation]='{ durationMs: 640, staggerMs: 32 }' ariaLabel="Cumulative signups, year to date" tooltip crosshair [legend]='{ position: "top" }' [data]='[5, 9, 14, 18, 26, 33, 39, 48, 57, 63, 72, 80]' [labels]='monthLabels' [max]='88' />`,})export class AreaChartDemoComponent { readonly monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];} export default AreaChartDemoComponent;ts
<script lang="ts"> import { AreaChart } from "@grassroot/charts-svelte"; const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];</script> <AreaChart animation={{ durationMs: 640, staggerMs: 32 }} ariaLabel="Cumulative signups, year to date" tooltip crosshair legend={{ position: "top" }} data={[5, 9, 14, 18, 26, 33, 39, 48, 57, 63, 72, 80]} labels={monthLabels} max={88} />ts
/** @jsxImportSource solid-js */import { AreaChart } from "@grassroot/charts-solid"; const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; export default function AreaChartDemo() { return <AreaChart animation={{ durationMs: 640, staggerMs: 32 }} ariaLabel="Cumulative signups, year to date" tooltip crosshair legend={{ position: "top" }} data={[5, 9, 14, 18, 26, 33, 39, 48, 57, 63, 72, 80]} labels={monthLabels} max={88} />;}Installation
bash
pnpm dlx grassroot add chart/area-chartbash
npx grassroot@latest add chart/area-chartbash
yarn dlx grassroot add chart/area-chartbash
bunx grassroot add chart/area-chartAPI Reference
| Prop | Type | Default |
|---|---|---|
datarequired | number[] | { x: number | Date | string; y: number | null | undefined; label?: string; }[] | — |
labels | string[] | undefined | — |
max | number | undefined | — |
color | string | undefined | — |
xDomain | ChartNumericDomain | ChartTimeDomain | undefined | — |
yDomain | ChartNumericDomain | undefined | — |
xAxis | ChartAxisOptions<number | Date> | undefined | — |
yAxis | ChartAxisOptions<number> | undefined | — |
showGrid | boolean | undefined | — |
formatXTick | ((value: number | Date, index: number) => string) | undefined | — |
formatYTick | ((value: number, index: number) => string) | undefined | — |