CLI previewInstall commands shown on this site are not released yet.

DocsChartsHierarchy

TreeChart

React example follows below.
ts
import { TreeChart } from "@grassroot/charts-react";
const hierarchy = {
label: "portfolio",
children: [
{ label: "Platform", value: 18 },
{ label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] },
],
};
<TreeChart root={hierarchy} />
ts
<script setup lang="ts">
import { TreeChart } 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>
<TreeChart :root='hierarchy' />
</template>
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootTreeChart } from "@grassroot/charts-angular";
@Component({
selector: "app-tree-chart-chart-demo",
standalone: true,
imports: [GrassrootTreeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<grassroot-tree-chart [root]='hierarchy' />`,
})
export class TreeChartDemoComponent {
readonly hierarchy = {
label: "portfolio",
children: [
{ label: "Platform", value: 18 },
{ label: "Product", children: [{ label: "Charts", value: 12 }, { label: "Catalog", value: 7 }] },
],
};
}
export default TreeChartDemoComponent;
ts
<script lang="ts">
import { TreeChart } 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>
<TreeChart root={hierarchy} />
ts
/** @jsxImportSource solid-js */
import { TreeChart } 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 TreeChartDemo() {
return <TreeChart root={hierarchy} />;
}

Installation

bash
pnpm dlx grassroot add chart/tree-chart
bash
npx grassroot@latest add chart/tree-chart
bash
yarn dlx grassroot add chart/tree-chart
bash
bunx grassroot add chart/tree-chart

API Reference

TreeChartProps
PropTypeDefault
rootrequiredHierarchyDatum