Icicle

nested spend (linear)

A sunburst unrolled flat. Harder to love, much easier to compare siblings.

Icicle — nested spend (linear): rendered example
Rendered by Gnomon from the source below. No edits.

The source

68 lines of D3 JavaScript, and uses only the bundled D3 build. Copy it, or open the template inside Gnomon and render it as it is.

// Icicle — a sunburst unrolled. Same data, but labels stay horizontal,
// which is the right trade when names are long.

const data = {
  name: 'Portfolio',
  children: [
    { name: 'Customer', children: [
      { name: 'Quote Engine',      value: 1240 },
      { name: 'Broker Portal',     value: 890  },
      { name: 'Customer Portal',   value: 1120 },
      { name: 'Contact Centre',    value: 1680 },
      { name: 'Campaign Manager',  value: 260  },
    ]},
    { name: 'Policy', children: [
      { name: 'Policy Admin Core', value: 4820 },
      { name: 'Legacy Ledger',     value: 1360 },
      { name: 'Underwriting',      value: 1140 },
      { name: 'Risk Scoring',      value: 520  },
    ]},
    { name: 'Claims', children: [
      { name: 'Claims Handling',   value: 2140 },
      { name: 'Fraud Detection',   value: 680  },
      { name: 'Supplier Network',  value: 410  },
    ]},
    { name: 'Enterprise', children: [
      { name: 'Data Lakehouse',    value: 1840 },
      { name: 'BI & Reporting',    value: 720  },
      { name: 'Cloud Platform',    value: 2960 },
      { name: 'Network Core',      value: 1340 },
    ]},
  ],
};

const root = d3.partition().size([height, width])(
  d3.hierarchy(data)
    .sum(d => d.value || 0)
    .sort((a, b) => b.value - a.value),
);

const color = d3.scaleOrdinal(data.children.map(c => c.name), theme.palette);
const topOf = d => d.ancestors().find(a => a.depth === 1)?.data.name ?? '';

const svg = d3.select(container).append('svg')
    .attr('viewBox', [0, 0, width, height])
    .attr('width', width)
    .attr('height', height)
    .attr('font-family', 'system-ui, sans-serif')
    .attr('font-size', 11);

const cell = svg.selectAll('g')
  .data(root.descendants())
  .join('g')
    .attr('transform', d => `translate(${d.y0},${d.x0})`);

cell.append('rect')
    .attr('width', d => Math.max(0, d.y1 - d.y0 - 1))
    .attr('height', d => Math.max(0, d.x1 - d.x0 - 1))
    .attr('rx', 2)
    .attr('fill', d => d.depth === 0 ? theme.muted : color(topOf(d)))
    .attr('fill-opacity', d => d.depth <= 1 ? 0.95 : 0.6);

cell.append('text')
    .attr('x', 6)
    .attr('y', d => (d.x1 - d.x0) / 2)
    .attr('dy', '0.35em')
    .attr('fill', theme.mode === 'dark' ? '#ffffff' : '#1a1a1a')
    .attr('display', d => (d.x1 - d.x0) > 14 ? null : 'none')
    .text(d => d.data.name);

Render this offline

This template ships in Gnomon and renders on your machine, with no account and no diagram uploads. The browser editor is free and needs no install.

Get GnomonOpen the browser editor

Others in D3 visualisations

Analytics cookies (optional)

May we use Google Analytics to understand visits, product links and feature use? If you accept, Google receives usage and device information, including your IP address, and sets analytics cookies. We do not send your documents, filenames or account details. Advertising features are disabled.

Analytics is off until you accept. Your choice is saved on this browser for 180 days using necessary local storage. You can change it at any time in Analytics preferences. Closing this message rejects analytics. Read our privacy policy.