Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1d219db
chore(deps): add d3-sankey for Sankey chart
rick-hup Apr 6, 2026
3444637
feat(sankey): add d3-sankey layout helper
rick-hup Apr 6, 2026
cac677a
feat(sankey): add Sankey chart with nodes and links
rick-hup Apr 6, 2026
5120c90
test(sankey): cover #node and #link slots and nodeWidth
rick-hup Apr 6, 2026
f33e321
test(sankey): cover node/link click event types
rick-hup Apr 6, 2026
399107e
test(sankey): cover tooltip integration for nodes and links
rick-hup Apr 6, 2026
a7728df
docs(sankey): add 5 Storybook stories
rick-hup Apr 6, 2026
cd54a91
chore(play): add Sankey playground page
rick-hup Apr 6, 2026
ae01b3c
docs(sankey): add Sankey chart docs page and demo
rick-hup Apr 6, 2026
c9c9fab
feat(sunburst): add layout utility with d3-hierarchy partition
rick-hup Apr 11, 2026
62d993a
feat(sunburst): add SunburstChart component with tooltip support
rick-hup Apr 11, 2026
575c23f
feat(sunburst): export SunburstChart from public API
rick-hup Apr 11, 2026
01f1029
docs(sunburst): add 5 Storybook stories
rick-hup Apr 11, 2026
3b93c19
chore(play): add Sunburst playground page
rick-hup Apr 11, 2026
85291a1
fix(types): widen selectActiveLabel return type to match combineActiv…
rick-hup Apr 11, 2026
4197d16
fix(docs): correct Sankey props table defaults and descriptions
rick-hup Apr 11, 2026
2153b6f
fix(sankey): use linkStroke prop for link path stroke color
rick-hup Apr 11, 2026
f0d01e3
fix(sunburst): wire ringPadding and padding props into layout calcula…
rick-hup Apr 11, 2026
1061467
fix(sunburst): use original data indices for tooltipIndex, not sorted…
rick-hup Apr 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dist
.claude/*
.agents/*
tasks/

.omx/*
# Docs site generated files
docs/.nuxt
docs/.data
Expand Down
56 changes: 56 additions & 0 deletions docs/app/charts/sankey-charts/custom-node-sankey-chart.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script setup>
import { Sankey, Tooltip } from 'vccs'

const data = {
nodes: [
{ name: 'Coal' },
{ name: 'Gas' },
{ name: 'Solar' },
{ name: 'Electricity' },
{ name: 'Heat' },
{ name: 'Industry' },
{ name: 'Homes' },
],
links: [
{ source: 0, target: 3, value: 30 },
{ source: 1, target: 3, value: 20 },
{ source: 2, target: 3, value: 15 },
{ source: 0, target: 4, value: 10 },
{ source: 1, target: 4, value: 8 },
{ source: 3, target: 5, value: 35 },
{ source: 3, target: 6, value: 30 },
{ source: 4, target: 6, value: 18 },
],
}
</script>

<template>
<Sankey
:data="data"
:width="730"
:height="360"
link-fill="#06b6d4"
>
<template #node="{ x, y, width, height, payload }">
<g>
<rect
:x="x"
:y="y"
:width="width"
:height="height"
fill="#f59e0b"
/>
<text
:x="x + width + 6"
:y="y + height / 2"
font-size="12"
dominant-baseline="middle"
fill="currentColor"
>
{{ payload.name }}
</text>
</g>
</template>
<Tooltip :cursor="false" />
</Sankey>
</template>
34 changes: 34 additions & 0 deletions docs/app/charts/sankey-charts/simple-sankey-chart.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup>
import { Sankey, Tooltip } from 'vccs'

const data = {
nodes: [
{ name: 'Visit' },
{ name: 'Sign up' },
{ name: 'Onboarding' },
{ name: 'Active' },
{ name: 'Drop off' },
{ name: 'Churned' },
],
links: [
{ source: 0, target: 1, value: 800 },
{ source: 0, target: 4, value: 200 },
{ source: 1, target: 2, value: 600 },
{ source: 1, target: 4, value: 200 },
{ source: 2, target: 3, value: 450 },
{ source: 2, target: 5, value: 150 },
],
}
</script>

<template>
<Sankey
:data="data"
:width="730"
:height="360"
node-fill="#f97316"
link-fill="#14b8a6"
>
<Tooltip :cursor="false" />
</Sankey>
</template>
66 changes: 66 additions & 0 deletions docs/content/3.charts/11.sankey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Sankey
description: Flow diagrams showing the magnitude of flow between nodes
navigation:
icon: i-lucide-git-fork
---

Sankey diagrams visualize flow quantities between a set of nodes, where the width of each link is proportional to its value. They are ideal for showing energy flows, user journeys, budget allocations, and similar many-to-many relationships.

## Simple Sankey

A basic Sankey diagram with nodes and weighted links. The layout is computed by `d3-sankey`.

::chart-demo{name="Simple Sankey" description="A Sankey diagram of a user funnel flow." src="sankey-charts/simple-sankey-chart"}
::

## Custom Node

Use the `#node` slot to fully customize how each node is rendered. The slot receives coordinates, dimensions, and the node payload.

::chart-demo{name="Custom Node Sankey" description="A Sankey diagram with custom node rendering showing labels." src="sankey-charts/custom-node-sankey-chart"}
::

## Sankey props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `data` | `{ nodes, links }` | **required** | Graph data with `nodes` and `links` arrays. Links use numeric `source`/`target` indices and a `value`. |
| `width` | `number` | **required** | Chart width in pixels |
| `height` | `number` | **required** | Chart height in pixels |
| `nodeWidth` | `number` | `10` | Width of each node rectangle |
| `nodePadding` | `number` | `10` | Vertical padding between nodes in the same column |
| `iterations` | `number` | `32` | Number of d3-sankey layout iterations for relaxation |
| `margin` | `{ top, right, bottom, left }` | `{ top: 5, right: 5, bottom: 5, left: 5 }` | Chart margins |
| `nodeFill` | `string` | `'#0088fe'` | Default fill color for node rectangles |
| `nodeStroke` | `string` | `'#fff'` | Stroke color for node rectangles |
| `linkFill` | `string` | `'#0088fe'` | Default fill color for link paths |
| `linkStroke` | `string` | `'none'` | Stroke color for link paths |
| `isAnimationActive` | `boolean` | `true` | Enable entrance animation |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
| `transition` | `AnimationOptions` | `{ duration: 0.8, ease: 'easeOut' }` | Animation timing (motion-v) |

## Slots

| Slot | Props | Description |
|------|-------|-------------|
| `#node` | `{ x, y, width, height, index, payload }` | Custom node rendering |
| `#link` | `{ d, sourceX, targetX, sourceY, targetY, linkWidth, index, payload }` | Custom link path rendering |
| `default` | — | Place `<Tooltip>` or other child components here. |

## Data structure

```ts
const data = {
nodes: [
{ name: 'A' },
{ name: 'B' },
{ name: 'C' },
],
links: [
{ source: 0, target: 1, value: 10 },
{ source: 1, target: 2, value: 6 },
],
}
```

`source` and `target` are numeric indices into the `nodes` array. `value` determines the link width. Both nodes and links support `<Tooltip>` hover interaction.
2 changes: 2 additions & 0 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@reduxjs/vue-redux": "^1.0.1",
"@vueuse/core": "^13.1.0",
"d3-hierarchy": "^3.1.2",
"d3-sankey": "^0.12.3",
"decimal.js-light": "^2.5.1",
"es-toolkit": "^1.39.3",
"eventemitter3": "^5.0.1",
Expand All @@ -65,6 +66,7 @@
"victory-vendor": "^37.3.6"
},
"devDependencies": {
"@types/d3-sankey": "^0.12.5",
"@types/lodash-es": "^4.17.12",
"@vitejs/plugin-vue-jsx": "^5.0.0",
"@vue/babel-plugin-jsx": "^1.1.1",
Expand Down
Loading
Loading