Skip to content

Commit 9e73c08

Browse files
fix(plugin-charts): a two-dimension sankey draws every flow, not only the first group's (#27560)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPi1WuDmCwpfQHCGmcaxKEh)_ Fixes #27460 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:桑基图拿到两个维度(例如 status × category)时,画出每一条 status → category 流向,不再只画第一个 category 的流向;点一条流向可下钻到那一格的记录。 - 为什么改:第二个维度被透视成多条序列,桑基图分支只读第一条,其余全部静默丢掉,看起来像一张完整的图(卡上 Alpha 3/2/2,Beta、Gamma 不见了)。 - 风险与回滚:只动桑基图分支;单序列桑基图、对比叠加、其他图表类型不变;回滚就是 revert 本 PR。 - 先看:`ui/packages/plugin-charts/src/AdvancedChartImpl.tsx` 的 `buildSankeyCellFlows` 与 sankey 分支开头;`ui/packages/plugin-dashboard/src/DatasetWidget.tsx` 的 `chartSeries`。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/plugin-charts/src/AdvancedChartImpl.sankeyTwoDimensions-27460.test.tsx`,预期 8 条全绿,其中一条逐条断言 6 条流向及数值。 - 需要你做的:无,席位落地。 ## What changes - **The sankey arm draws a pivot as two columns of nodes.** Two or more flow series (every series except a `variant: 'comparison'` overlay) reaching the sankey are the groups of a pivoted second dimension: the spec refuses a second measure on a sankey (`SINGLE_SERIES_CHART_TYPES`), and `buildChartSeries` pivots the second dimension into series exactly when the chart carries one measure. `buildSankeyCellFlows` makes each row's category a source node, each series a target node, and each cell the row carries a flow valued by the cell. One flow series keeps the one-level arm byte for byte. - **Absent is not omitted; non-positive is said.** A cell the row does not carry is a combination the dataset did not answer, so it is no flow and no omission. A carried cell that is not above zero is dropped and the existing omitted-rows note (`chart.sankeyOmittedRows`, no new strings) is printed once per target column that lost a cell. No carried cell above zero is the existing `no-positive-flow` refusal, naming every column. - **A flow click drills to its cell.** A link is exactly one `(category, series)` pair, the pair `findChartSeriesRow` resolves to one dataset row; the event carries `category`, `categoryId`, `series`, `seriesLabel` and `value`. A node spans several cells, so a node click does not drill (as the one-level root does not). - **`DatasetWidget` hands a sankey only the measure it renders.** A stored sankey that declares several measures (refused at publish) would otherwise have its later measures drawn as groups, and the dropped-measure warning would be false. A pivot carries one measure, so nothing is filtered from it. The `SINGLE_SERIES_CHART_FAMILIES` docblock says so. ## Tests - New `AdvancedChartImpl.sankeyTwoDimensions-27460.test.tsx` (8): the pivot is built with `buildChartSeries` from the card's shape (3 statuses × 3 categories, 6 answered pairs); it asserts the six flows `source → target: value`, the six links and six named nodes, no note for unanswered pairs, the note for a carried negative cell, the refusal for all-zero cells, the flow click and no node click; controls: one series and a comparison overlay stay one-level. - New `DatasetWidget.sankeyTwoDimensions-27460.test.tsx` (1): the card's widget through the real chain draws all six nodes and six links. - `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-charts/ packages/plugin-dashboard/`: Test Files 294 passed (294), Tests 3175 passed, 15 skipped, at `13e084eb`. ## Acceptance notes - **Ablation (renderer).** `if (flowSeries.length >= 2)` → `if (false && …)` through `scripts/ablation-replace.mjs` (anchor 1 → 0, blob restored to HEAD, `git diff HEAD` empty): 5 of 9 red, the first reading `expected [ 'Alpha → Open: 3', …(2) ]`, the card's 3/2/2; the two one-series controls stayed green. - **Ablation (dashboard).** `chartType === 'sankey'` → `'ablated'` in `chartSeries`: `DatasetWidget.singleSeriesMeasures-11417.test.tsx` goes red on `sankey: fires iff the second measure's values leave the drawn chart unchanged` (1 of 22), so the existing tie pins the filter. - **pie / donut / funnel / treemap** each bind `series[0]` too (their arms read `series[0]?.dataKey` and nothing else; read on `13e084eb`, not rendered), so a two-dimension pivot on them draws only the first second-dimension group. The two-level fix does not cover them (a pie has no second column of nodes); they are reported to the seat, not fixed here. - **A pivot with ONE second-dimension value** reaches the arm as one series and draws the one-level shape: that value as the root, flowing to each first-dimension value. Every flow is drawn; only the orientation differs from the two-level shape. - **An inline `object-chart` sankey with two measures** (no publish-time arity refusal on that node) now draws category → measure flows instead of silently dropping the second measure. - Three or more dimensions: `buildChartSeries` pivots only the second dimension, a cross-family question outside this card. ## Verification Local gates from `node scripts/dispatch-gates.mjs --commands` at `13e084eb`, each exit captured before any pipe and reconciled with `--ran`; type-check of both packages; every other family is CI's and is cited from the PR's check runs in the report. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgWJECm7uQEkPAHKqat)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8243694 commit 9e73c08

5 files changed

Lines changed: 465 additions & 5 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/plugin-charts': patch
3+
'@object-ui/plugin-dashboard': patch
4+
---
5+
6+
fix(plugin-charts): a sankey with two dimensions draws every flow from the first dimension to the second, instead of only the first second-dimension group's
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
A dashboard widget (or a dataset-bound chart) of type `sankey` with `dimensions: ['status', 'category']` and one measure used to draw a single root node, the first `category` value, with only that value's flows; every other `category` value was dropped and nothing on the chart said so. The second dimension reaches the renderer pivoted into one series per value, and the sankey read the first series only.
12+
13+
- **Every cell is a flow.** Two or more series on a sankey are now drawn as two columns of nodes: each first-dimension value flows into each second-dimension value it has records for, and the flow's width is the measure. A combination the dataset did not answer is no flow and is not reported as missing.
14+
- **A partial flow says so.** A cell that is not above zero cannot be drawn as a flow; the chart prints the existing omitted-rows note once per second-dimension value that lost a cell, and a chart with no cell above zero shows the existing "no flow to draw" refusal, naming every column it tested.
15+
- **Clicking a flow drills to its cell**, the one dataset row for that pair. A node spans several cells, so a node click does not drill.
16+
- **Unchanged:** a sankey with one series draws the same one-level flow from the measure to each category. A comparison overlay (`compareTo`) is never drawn as a flow. A stored sankey widget that declares several measures (refused at publish by the spec) is handed only its first measure, as before, so its other measures are not drawn as groups.
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* A sankey with TWO dimensions draws every (first → second dimension) flow
6+
* (objectstack#27460).
7+
*
8+
* `buildChartSeries` pivots a second dimension into series when the chart
9+
* carries one measure: one row per first-dimension value, one series per
10+
* second-dimension value. The sankey arm read `series[0]` alone, so a
11+
* `status × category` task count drew ONE root node (the first category,
12+
* `Alpha`) and its 3 / 2 / 2 flows, and the `Beta` and `Gamma` columns were
13+
* dropped with nothing on the chart saying so. The pivot is built here with
14+
* the same helper the dashboard widget and the inline chart call, so the
15+
* fixture is the shape the arm is really handed.
16+
*/
17+
import React from 'react';
18+
import { describe, it, expect, afterEach, vi } from 'vitest';
19+
import { render, cleanup, fireEvent } from '@testing-library/react';
20+
import { buildChartSeries } from '@object-ui/core';
21+
22+
/** Every `data` prop the Sankey was rendered with, newest last. */
23+
const sankeyData: Array<{ nodes: Array<{ name: string }>; links: Array<{ source: number; target: number; value: number }> }> = [];
24+
25+
vi.mock('recharts', async () => {
26+
const actual = await vi.importActual<any>('recharts');
27+
return {
28+
...actual,
29+
ResponsiveContainer: ({ children }: any) =>
30+
React.cloneElement(children, { width: 480, height: 320 }),
31+
Sankey: (props: any) => {
32+
sankeyData.push(props.data);
33+
return <actual.Sankey {...props} />;
34+
},
35+
};
36+
});
37+
38+
import AdvancedChartImpl from './AdvancedChartImpl';
39+
40+
afterEach(() => {
41+
cleanup();
42+
sankeyData.length = 0;
43+
});
44+
45+
/** The dataset's answer: one row per (status, category) combination it found. */
46+
const FLAT = [
47+
{ status: 'Open', category: 'Alpha', task_count: 3 },
48+
{ status: 'Open', category: 'Beta', task_count: 1 },
49+
{ status: 'Done', category: 'Alpha', task_count: 2 },
50+
{ status: 'Done', category: 'Gamma', task_count: 4 },
51+
{ status: 'Blocked', category: 'Alpha', task_count: 2 },
52+
{ status: 'Blocked', category: 'Beta', task_count: 5 },
53+
];
54+
55+
const pivot = (rows: Array<Record<string, unknown>>) =>
56+
buildChartSeries(rows, ['status', 'category'], ['task_count']);
57+
58+
const renderPivot = (rows: Array<Record<string, unknown>>, extra: Record<string, unknown> = {}) => {
59+
const { data, xAxisKey, series } = pivot(rows);
60+
return render(
61+
<AdvancedChartImpl
62+
chartType="sankey"
63+
data={data as any}
64+
xAxisKey={xAxisKey}
65+
series={series as any}
66+
isAnimationActive={false}
67+
{...extra}
68+
/>,
69+
);
70+
};
71+
72+
/** The drawn flows as `source → target: value`, read off the Sankey's own data. */
73+
const drawnFlows = () => {
74+
const { nodes, links } = sankeyData[sankeyData.length - 1];
75+
return links.map((l) => `${nodes[l.source].name} → ${nodes[l.target].name}: ${l.value}`);
76+
};
77+
78+
const noteTexts = (container: HTMLElement) =>
79+
[...container.querySelectorAll('[data-chart-note="omitted-rows"]')].map((n) => n.textContent);
80+
81+
describe('objectstack#27460 — a two-dimension sankey draws every flow', () => {
82+
it('the fixture is a real pivot: three first-dimension rows, three series', () => {
83+
const { data, series } = pivot(FLAT);
84+
expect(data.map((r) => r.status)).toEqual(['Open', 'Done', 'Blocked']);
85+
expect(series.map((s) => s.label)).toEqual(['Alpha', 'Beta', 'Gamma']);
86+
});
87+
88+
it('draws one flow per (status, category) cell, valued by the measure', () => {
89+
const { container } = renderPivot(FLAT);
90+
expect(drawnFlows()).toEqual([
91+
'Open → Alpha: 3',
92+
'Open → Beta: 1',
93+
'Done → Alpha: 2',
94+
'Done → Gamma: 4',
95+
'Blocked → Alpha: 2',
96+
'Blocked → Beta: 5',
97+
]);
98+
expect(container.querySelectorAll('.recharts-sankey-link')).toHaveLength(6);
99+
// Every first- and second-dimension value is a node, each drawn with its name.
100+
expect([...container.querySelectorAll('.recharts-sankey-node-label')].map((t) => t.textContent).sort()).toEqual(
101+
['Alpha', 'Beta', 'Blocked', 'Done', 'Gamma', 'Open'],
102+
);
103+
});
104+
105+
it('a combination the dataset did not answer is no flow and no omission', () => {
106+
// Open × Gamma, Done × Beta and Blocked × Gamma have no records: the pivot
107+
// writes no column for them, and the chart is complete.
108+
const { container } = renderPivot(FLAT);
109+
expect(noteTexts(container)).toEqual([]);
110+
expect(container.querySelector('[data-chart-error]')).toBeNull();
111+
});
112+
113+
it('a carried cell that is not above zero is dropped, and the chart says so', () => {
114+
const rows = FLAT.map((r) => (r.status === 'Open' && r.category === 'Beta' ? { ...r, task_count: -1 } : r));
115+
const { container } = renderPivot(rows);
116+
expect(drawnFlows()).not.toContain('Open → Beta: -1');
117+
expect(drawnFlows()).toHaveLength(5);
118+
expect(noteTexts(container)).toEqual([
119+
'Showing 1 of 2 rows — 1 row has no Beta above zero, which a flow cannot draw.',
120+
]);
121+
});
122+
123+
it('no carried cell above zero is the no-positive-flow refusal, naming every column', () => {
124+
const rows = FLAT.map((r) => ({ ...r, task_count: 0 }));
125+
const { container } = renderPivot(rows);
126+
const refusal = container.querySelector('[data-chart-error="no-positive-flow"]');
127+
expect(refusal).not.toBeNull();
128+
expect([...refusal!.querySelectorAll('code')].map((c) => c.textContent)).toEqual(['Alpha', 'Beta', 'Gamma']);
129+
expect(container.querySelector('svg')).toBeNull();
130+
});
131+
132+
it('a flow click drills to its one cell; a node click does not drill', () => {
133+
const onChartClick = vi.fn();
134+
const { container } = renderPivot(FLAT, { onChartClick });
135+
const links = container.querySelectorAll('.recharts-sankey-link');
136+
fireEvent.click(links[3]);
137+
expect(onChartClick).toHaveBeenCalledTimes(1);
138+
expect(onChartClick).toHaveBeenCalledWith(
139+
expect.objectContaining({ category: 'Done', series: 'Gamma', seriesLabel: 'Gamma', value: 4 }),
140+
);
141+
onChartClick.mockClear();
142+
for (const node of container.querySelectorAll('.recharts-sankey-node')) fireEvent.click(node);
143+
expect(onChartClick).not.toHaveBeenCalled();
144+
});
145+
});
146+
147+
describe('objectstack#27460 — CONTROL: a one-series sankey is unchanged', () => {
148+
const ROWS = [
149+
{ stage: 'New business', amount: 40 },
150+
{ stage: 'Upsell', amount: 25 },
151+
];
152+
153+
it('flows from the measure root to each category', () => {
154+
render(
155+
<AdvancedChartImpl
156+
chartType="sankey"
157+
data={ROWS as any}
158+
xAxisKey="stage"
159+
series={[{ dataKey: 'amount', label: 'Amount' }] as any}
160+
isAnimationActive={false}
161+
/>,
162+
);
163+
expect(drawnFlows()).toEqual(['Amount → New business: 40', 'Amount → Upsell: 25']);
164+
});
165+
166+
it('a comparison overlay is never a flow: one current series stays one-level', () => {
167+
render(
168+
<AdvancedChartImpl
169+
chartType="sankey"
170+
data={ROWS.map((r) => ({ ...r, amount__compare: 10 })) as any}
171+
xAxisKey="stage"
172+
series={[
173+
{ dataKey: 'amount', label: 'Amount', variant: 'current' },
174+
{ dataKey: 'amount__compare', label: 'Amount · previous period', variant: 'comparison' },
175+
] as any}
176+
isAnimationActive={false}
177+
/>,
178+
);
179+
expect(drawnFlows()).toEqual(['Amount → New business: 40', 'Amount → Upsell: 25']);
180+
});
181+
});

‎ui/packages/plugin-charts/src/AdvancedChartImpl.tsx‎

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,93 @@ function SankeyOmittedRowsNote({ shown, total, dataKey }: { shown: number; total
11531153
);
11541154
}
11551155

1156+
/**
1157+
* The series a sankey draws as FLOWS (objectstack#27460): every series except a
1158+
* comparison overlay, which is the same measure one period back and no group of
1159+
* it, so it never becomes a flow.
1160+
*/
1161+
const sankeyFlowSeries = (series: readonly NormalizedSeries[]): NormalizedSeries[] =>
1162+
series.filter((s) => s.variant !== 'comparison');
1163+
1164+
/** One drawn flow of a two-level sankey, and the cell it was drawn from. */
1165+
interface SankeyCellLink {
1166+
source: number;
1167+
target: number;
1168+
value: number;
1169+
/** The `data` row the flow leaves — what a click drills to, with `seriesKey`. */
1170+
rowIndex: number;
1171+
/** The series (the second dimension's group) the flow enters. */
1172+
seriesKey: string;
1173+
}
1174+
1175+
/** A target column whose carried cells were not all drawn: the omitted-rows note's inputs. */
1176+
interface SankeyOmittedColumn {
1177+
label: string;
1178+
shown: number;
1179+
total: number;
1180+
}
1181+
1182+
/**
1183+
* A TWO-LEVEL sankey: each row's category flows into each series it carries
1184+
* (objectstack#27460).
1185+
*
1186+
* A sankey declares ONE measure (the spec's `SINGLE_SERIES_CHART_TYPES` refuses
1187+
* a second), so two or more flow series reaching the arm are the groups of that
1188+
* one measure: `buildChartSeries` pivots a SECOND dimension into series exactly
1189+
* when the chart carries one measure, one row per first-dimension value and one
1190+
* column per second-dimension value. The arm used to read `series[0]` alone and
1191+
* drew the first group's flows as if they were the whole chart, with nothing
1192+
* saying the rest were dropped. Here every cell is a flow: source = the row's
1193+
* category (`xAxisKey`), target = the series, width = the cell.
1194+
*
1195+
* A cell the row does not CARRY is not a flow and not an omission: the pivot
1196+
* writes a column only for a combination the dataset answered, so an absent key
1197+
* is a combination with no records. A cell it carries that is not above zero is
1198+
* dropped, as the one-level arm drops a row, and counted per target column, so
1199+
* the chart says which flows it left out. Nodes with no drawn flow are left out
1200+
* too: Recharts would draw them as zero-height bars with a label and no link.
1201+
*/
1202+
function buildSankeyCellFlows(
1203+
data: ReadonlyArray<Record<string, any>>,
1204+
xAxisKey: string,
1205+
flowSeries: readonly NormalizedSeries[],
1206+
palette: readonly string[],
1207+
): { nodes: Array<{ name: string; fill: string }>; links: SankeyCellLink[]; omitted: SankeyOmittedColumn[] } {
1208+
const cells = data.map((row) =>
1209+
flowSeries.map((s) => {
1210+
const carried = row != null && Object.prototype.hasOwnProperty.call(row, s.dataKey);
1211+
return { carried, value: carried ? Number(row[s.dataKey]) || 0 : 0 };
1212+
}),
1213+
);
1214+
const sourceRows = data.flatMap((_, i) => (cells[i].some((c) => c.value > 0) ? [i] : []));
1215+
const targetColumns = flowSeries.flatMap((_, j) => (cells.some((r) => r[j].value > 0) ? [j] : []));
1216+
const nodes = [
1217+
...sourceRows.map((i, n) => ({
1218+
name: String(data[i]?.[xAxisKey] ?? ''),
1219+
fill: resolveColor(palette[n % palette.length]),
1220+
})),
1221+
...targetColumns.map((j, n) => ({
1222+
name: String(flowSeries[j].label ?? flowSeries[j].dataKey),
1223+
fill: resolveColor(palette[(sourceRows.length + n) % palette.length]),
1224+
})),
1225+
];
1226+
const links: SankeyCellLink[] = [];
1227+
sourceRows.forEach((i, sourceNode) => {
1228+
targetColumns.forEach((j, n) => {
1229+
const { value } = cells[i][j];
1230+
if (value > 0) {
1231+
links.push({ source: sourceNode, target: sourceRows.length + n, value, rowIndex: i, seriesKey: flowSeries[j].dataKey });
1232+
}
1233+
});
1234+
});
1235+
const omitted = flowSeries.flatMap((s, j) => {
1236+
const total = cells.filter((r) => r[j].carried).length;
1237+
const shown = cells.filter((r) => r[j].value > 0).length;
1238+
return shown < total ? [{ label: String(s.label ?? s.dataKey), shown, total }] : [];
1239+
});
1240+
return { nodes, links, omitted };
1241+
}
1242+
11561243
/**
11571244
* Renders the spec's `ChartConfig.title` / `.subtitle` above the plot.
11581245
*
@@ -2028,7 +2115,30 @@ function AdvancedChartImplInner({
20282115

20292116
const scatterClickProps = onChartClick ? { onClick: handleScatterClick, cursor: 'pointer' } : {};
20302117
const treemapClickProps = onChartClick ? { onClick: handleTreemapClick, style: { cursor: 'pointer' as const } } : {};
2118+
// A two-level sankey (objectstack#27460) drills on a FLOW: a link is exactly
2119+
// one cell, the row it leaves and the series it enters, which is the
2120+
// `{ category, series }` pair the drill lookup resolves to one dataset row. A
2121+
// node is no single cell — a category node spans every series and a series
2122+
// node every category — so a node click does not drill, as the one-level
2123+
// root does not.
2124+
const handleSankeyFlowClick = React.useCallback((item: any, type?: string) => {
2125+
if (!onChartClick || type !== 'link') return;
2126+
const link = item?.payload as Partial<SankeyCellLink> | undefined;
2127+
const row = typeof link?.rowIndex === 'number' ? data[link.rowIndex] : undefined;
2128+
const key = link?.seriesKey;
2129+
if (!row || typeof key !== 'string') return;
2130+
const cat = row[xAxisKey];
2131+
onChartClick({
2132+
category: cat != null ? String(cat) : undefined,
2133+
categoryId: chartRowBucketId(row),
2134+
series: key,
2135+
seriesLabel: seriesLabelForKey(key, series),
2136+
value: typeof row[key] === 'number' ? row[key] : undefined,
2137+
});
2138+
}, [onChartClick, data, xAxisKey, series]);
2139+
20312140
const sankeyClickProps = onChartClick ? { onClick: handleSankeyClick, style: { cursor: 'pointer' as const } } : {};
2141+
const sankeyFlowClickProps = onChartClick ? { onClick: handleSankeyFlowClick, style: { cursor: 'pointer' as const } } : {};
20322142

20332143
React.useEffect(() => {
20342144
const checkMobile = () => setIsMobile(window.innerWidth < 640);
@@ -2707,6 +2817,59 @@ function AdvancedChartImplInner({
27072817
// (The dashboard aggregate yields one value per category; a real multi-stage
27082818
// flow needs richer data, but this honestly renders the sankey family.)
27092819
if (chartType === 'sankey') {
2820+
// Two or more flow series are the groups of a pivoted second dimension,
2821+
// drawn as a second column of nodes (objectstack#27460,
2822+
// `buildSankeyCellFlows`). One series keeps the one-level flow below.
2823+
const flowSeries = sankeyFlowSeries(series);
2824+
if (flowSeries.length >= 2) {
2825+
const flows = buildSankeyCellFlows(data, xAxisKey, flowSeries, getPalette());
2826+
if (flows.links.length === 0) {
2827+
// Rows arrived and none carries a cell above zero: the one-level
2828+
// refusal below (objectui#7140), naming every column it tested.
2829+
if (data.length === 0) {
2830+
return <div className={className} />;
2831+
}
2832+
return (
2833+
<ChartRefusal code="no-positive-flow" className={className}>
2834+
This chart has no flow to draw: no row&apos;s{' '}
2835+
{flowSeries.map((s, i) => (
2836+
<React.Fragment key={s.dataKey}>
2837+
{i > 0 ? ' / ' : null}
2838+
<code className="font-mono">{s.label ?? s.dataKey}</code>
2839+
</React.Fragment>
2840+
))}{' '}
2841+
is above zero.
2842+
</ChartRefusal>
2843+
);
2844+
}
2845+
// A partial flow says it is partial (objectui#7148), once per target
2846+
// column that left a carried cell out.
2847+
return (
2848+
<ChartFootnote
2849+
note={
2850+
flows.omitted.length > 0 ? (
2851+
<>
2852+
{flows.omitted.map((c) => (
2853+
<SankeyOmittedRowsNote key={c.label} shown={c.shown} total={c.total} dataKey={c.label} />
2854+
))}
2855+
</>
2856+
) : null
2857+
}
2858+
>
2859+
<ChartContainer config={config} className={className} {...containerProps}>
2860+
<Sankey
2861+
data={{ nodes: flows.nodes, links: flows.links }}
2862+
nodePadding={24}
2863+
link={SankeyLinkShape}
2864+
node={SankeyNodeShape}
2865+
{...sankeyFlowClickProps}
2866+
>
2867+
<Tooltip />
2868+
</Sankey>
2869+
</ChartContainer>
2870+
</ChartFootnote>
2871+
);
2872+
}
27102873
const dataKey = series[0]?.dataKey || 'value';
27112874
const rootName = series[0]?.label || dataKey;
27122875
const rows = data.filter((r) => (Number(r?.[dataKey]) || 0) > 0);

0 commit comments

Comments
 (0)