Instrument · Free · Recharts or ECharts

Treemap: pick what's on it

Every option is a prop of the installed chart. The preview and the code use the same props, so what you copy is what you see.

Options, preview and code

Engine
Presets
Shape
Legend
Tooltip
Colours
Behaviour
Feel
States

Cloud spend · September

Where the money goes

Instances is the largest, at 40% of the total. The top 3 make up 69%. Compute is the largest group (47%).

Treemap of 8 items totalling 46,200. Instances is the largest, at 40% of the total. The top 3 make up 69%. Compute is the largest group (47%).
AreaItemSpendShare of total
Code for this chart

"use client";

// Install: npx shadcn@latest add https://beautifulcharts.dev/r/treemap.json
import { TreemapChart } from "@/components/beautiful-charts/themes/instrument/recharts/treemap-chart";
import type { ChartConfig } from "@/components/beautiful-charts/core/contracts";

const data = [
  { area: "Compute", item: "Instances", usd: 18400 },
  { area: "Compute", item: "Functions", usd: 3200 },
  { area: "Storage", item: "Objects", usd: 6100 },
  { area: "Storage", item: "Backups", usd: 2400 },
  { area: "Network", item: "Egress", usd: 4800 },
  { area: "Network", item: "CDN", usd: 1900 },
  { area: "Data", item: "Warehouse", usd: 7300 },
  { area: "Data", item: "Streaming", usd: 2100 },
];

const config = {
  usd: { label: "Spend" },
} satisfies ChartConfig;

export function MyChart() {
  return (
    <TreemapChart
      data={data}
      config={config}
      nameKey="item"
      valueKey="usd"
      groupKey="area"
      eyebrow="Cloud spend · September"
      title="Where the money goes"
    />
  );
}