DocsChartsHierarchy
PackChart
React example follows below.
ts
import { PackChart } from "@grassroot/charts-react"; const hierarchy = { label: "portfolio", children: [ { label: "Platform", value: 18 }, { label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] }, ],}; <PackChart root={hierarchy} />ts
<script setup lang="ts">import { PackChart } from "@grassroot/charts-vue"; const hierarchy = { label: "portfolio", children: [ { label: "Platform", value: 18 }, { label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] }, ],};</script> <template> <PackChart :root='hierarchy' /></template>ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootPackChart } from "@grassroot/charts-angular"; @Component({ selector: "app-pack-chart-chart-demo", standalone: true, imports: [GrassrootPackChart], changeDetection: ChangeDetectionStrategy.OnPush, template: `<grassroot-pack-chart [root]='hierarchy' />`,})export class PackChartDemoComponent { readonly hierarchy = { label: "portfolio", children: [ { label: "Platform", value: 18 }, { label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] }, ], };} export default PackChartDemoComponent;ts
<script lang="ts"> import { PackChart } from "@grassroot/charts-svelte"; const hierarchy = { label: "portfolio", children: [ { label: "Platform", value: 18 }, { label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] }, ], };</script> <PackChart root={hierarchy} />ts
/** @jsxImportSource solid-js */import { PackChart } from "@grassroot/charts-solid"; const hierarchy = { label: "portfolio", children: [ { label: "Platform", value: 18 }, { label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] }, ],}; export default function PackChartDemo() { return <PackChart root={hierarchy} />;}Installation
bash
pnpm dlx grassroot add chart/pack-chartbash
npx grassroot@latest add chart/pack-chartbash
yarn dlx grassroot add chart/pack-chartbash
bunx grassroot add chart/pack-chartAPI Reference
| Prop | Type | Default |
|---|---|---|
rootrequired | HierarchyDatum | — |