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

DocsChartsHierarchy

TreemapChart

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

Installation

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

API Reference

TreemapChartProps
PropTypeDefault
rootrequiredHierarchyDatum