From 3becf9b8cde52e52346af382442921d1c9a0f99c Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Wed, 22 Oct 2025 18:15:05 +0200 Subject: [PATCH 01/12] add regression --- test/regressions/charts/SankeyNodeOrder.tsx | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/regressions/charts/SankeyNodeOrder.tsx diff --git a/test/regressions/charts/SankeyNodeOrder.tsx b/test/regressions/charts/SankeyNodeOrder.tsx new file mode 100644 index 0000000000000..d5db14fc4c98b --- /dev/null +++ b/test/regressions/charts/SankeyNodeOrder.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; +import { Unstable_SankeyChart as SankeyChart } from '@mui/x-charts-pro/SankeyChart'; + +const data = { + nodes: [ + { id: 'A' }, + { id: 'B' }, + { id: 'C' }, + { id: 'D' }, + { id: 'E' }, + { id: 'F' }, + { id: 'G' }, + ], + + links: [ + { source: 'A', target: 'F', value: 90 }, + { source: 'B', target: 'F', value: 10 }, + { source: 'C', target: 'G', value: 80 }, + { source: 'D', target: 'G', value: 20 }, + { source: 'E', target: 'G', value: 5 }, + { source: 'F', target: 'H', value: 100 }, + ], +}; + +export default function SankeyIncomeStatement() { + return ( + + ); +} From ff366b5d32cbf03e95e9882ebe41a93611fac19e Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Wed, 22 Oct 2025 18:24:55 +0200 Subject: [PATCH 02/12] fix node order --- .../src/SankeyChart/calculateSankeyLayout.ts | 25 +++++++++++++------ test/regressions/charts/SankeyNodeOrder.tsx | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts index 71ece3636faa6..2b6667e68381f 100644 --- a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts +++ b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts @@ -9,6 +9,7 @@ import type { SankeyLayoutLink, SankeyLayoutNode, DefaultizedSankeySeriesType, + SankeyNodeId, } from './sankey.types'; import { getNodeAlignFunction } from './utils'; @@ -47,14 +48,26 @@ export function calculateSankeyLayout( } // Prepare the data structure expected by d3-sankey + const nodesArray = data.nodes.values().toArray(); const graph = { - nodes: data.nodes - .values() - .toArray() - .map((v) => ({ ...v })), + nodes: nodesArray.map((v) => ({ ...v })), links: data.links.map((v) => ({ ...v })), }; + const nodeIndexMap = new Map(); + for (let index = 0; index < nodesArray.length; index += 1) { + const node = nodesArray[index]; + nodeIndexMap.set(node.id, index); + } + + const defaultNodeSort = !nodeSort + ? (a: SankeyLayoutNode, b: SankeyLayoutNode) => { + const indexA = nodeIndexMap.get(a.id) ?? Infinity; + const indexB = nodeIndexMap.get(b.id) ?? Infinity; + return indexA - indexB; + } + : nodeSort; + // Create the sankey layout generator let sankeyGenerator = sankey() .nodeWidth(nodeWidth) @@ -67,9 +80,7 @@ export function calculateSankeyLayout( .nodeId((d) => d.id) .iterations(iterations); - if (nodeSort) { - sankeyGenerator = sankeyGenerator.nodeSort(nodeSort); - } + sankeyGenerator = sankeyGenerator.nodeSort(defaultNodeSort); if (linkSort) { sankeyGenerator = sankeyGenerator.linkSort(linkSort); } diff --git a/test/regressions/charts/SankeyNodeOrder.tsx b/test/regressions/charts/SankeyNodeOrder.tsx index d5db14fc4c98b..c682f96d4a3de 100644 --- a/test/regressions/charts/SankeyNodeOrder.tsx +++ b/test/regressions/charts/SankeyNodeOrder.tsx @@ -10,6 +10,7 @@ const data = { { id: 'E' }, { id: 'F' }, { id: 'G' }, + { id: 'H' }, ], links: [ From 97c2ef86c6f29d26f936c9583560453285ac6849 Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Thu, 23 Oct 2025 11:20:45 +0200 Subject: [PATCH 03/12] Revert "fix node order" This reverts commit ff366b5d32cbf03e95e9882ebe41a93611fac19e. --- .../src/SankeyChart/calculateSankeyLayout.ts | 25 ++++++------------- test/regressions/charts/SankeyNodeOrder.tsx | 1 - 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts index 2b6667e68381f..71ece3636faa6 100644 --- a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts +++ b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts @@ -9,7 +9,6 @@ import type { SankeyLayoutLink, SankeyLayoutNode, DefaultizedSankeySeriesType, - SankeyNodeId, } from './sankey.types'; import { getNodeAlignFunction } from './utils'; @@ -48,26 +47,14 @@ export function calculateSankeyLayout( } // Prepare the data structure expected by d3-sankey - const nodesArray = data.nodes.values().toArray(); const graph = { - nodes: nodesArray.map((v) => ({ ...v })), + nodes: data.nodes + .values() + .toArray() + .map((v) => ({ ...v })), links: data.links.map((v) => ({ ...v })), }; - const nodeIndexMap = new Map(); - for (let index = 0; index < nodesArray.length; index += 1) { - const node = nodesArray[index]; - nodeIndexMap.set(node.id, index); - } - - const defaultNodeSort = !nodeSort - ? (a: SankeyLayoutNode, b: SankeyLayoutNode) => { - const indexA = nodeIndexMap.get(a.id) ?? Infinity; - const indexB = nodeIndexMap.get(b.id) ?? Infinity; - return indexA - indexB; - } - : nodeSort; - // Create the sankey layout generator let sankeyGenerator = sankey() .nodeWidth(nodeWidth) @@ -80,7 +67,9 @@ export function calculateSankeyLayout( .nodeId((d) => d.id) .iterations(iterations); - sankeyGenerator = sankeyGenerator.nodeSort(defaultNodeSort); + if (nodeSort) { + sankeyGenerator = sankeyGenerator.nodeSort(nodeSort); + } if (linkSort) { sankeyGenerator = sankeyGenerator.linkSort(linkSort); } diff --git a/test/regressions/charts/SankeyNodeOrder.tsx b/test/regressions/charts/SankeyNodeOrder.tsx index c682f96d4a3de..d5db14fc4c98b 100644 --- a/test/regressions/charts/SankeyNodeOrder.tsx +++ b/test/regressions/charts/SankeyNodeOrder.tsx @@ -10,7 +10,6 @@ const data = { { id: 'E' }, { id: 'F' }, { id: 'G' }, - { id: 'H' }, ], links: [ From f8c462a2dbdefbb15957e7212436f6630bfe036b Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Thu, 23 Oct 2025 11:22:42 +0200 Subject: [PATCH 04/12] always use null as default --- .../src/SankeyChart/calculateSankeyLayout.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts index 71ece3636faa6..f224f0b6b2f9a 100644 --- a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts +++ b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts @@ -32,14 +32,10 @@ export function calculateSankeyLayout( width: nodeWidth = 15, padding: nodePadding = 10, align: nodeAlign = 'justify', - sort: nodeSort = null, + sort: nodeSort, } = nodeOptions ?? {}; - const { - color: linkColor = 'source', - sort: linkSort = null, - curveCorrection = 10, - } = linkOptions ?? {}; + const { color: linkColor = 'source', sort: linkSort, curveCorrection = 10 } = linkOptions ?? {}; const { width, height, left, top, bottom, right } = drawingArea; if (!data || !data.links) { @@ -56,7 +52,7 @@ export function calculateSankeyLayout( }; // Create the sankey layout generator - let sankeyGenerator = sankey() + const sankeyGenerator = sankey() .nodeWidth(nodeWidth) .nodePadding(nodePadding) .nodeAlign(getNodeAlignFunction(nodeAlign)) @@ -67,11 +63,17 @@ export function calculateSankeyLayout( .nodeId((d) => d.id) .iterations(iterations); - if (nodeSort) { - sankeyGenerator = sankeyGenerator.nodeSort(nodeSort); + if (typeof nodeSort === 'function') { + sankeyGenerator.nodeSort(nodeSort); + } else { + // Null is not accepted by the types. + sankeyGenerator.nodeSort(null as any); } - if (linkSort) { - sankeyGenerator = sankeyGenerator.linkSort(linkSort); + if (typeof linkSort === 'function') { + sankeyGenerator.linkSort(linkSort); + } else { + // Null is not accepted by the types. + sankeyGenerator.linkSort(null as any); } // Generate the layout From 32dd471ba6ae60c9d8cf4a2ef540fefda6983732 Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Thu, 23 Oct 2025 16:46:46 +0200 Subject: [PATCH 05/12] auto/fixed --- docs/data/charts/sankey/SankeyLinkSorting.js | 29 ++++++++++++-- docs/data/charts/sankey/SankeyLinkSorting.tsx | 39 +++++++++++++++---- docs/data/charts/sankey/SankeyNodeSorting.js | 37 ++++++++++++++++-- docs/data/charts/sankey/SankeyNodeSorting.tsx | 37 ++++++++++++++++-- docs/data/charts/sankey/sankey.md | 18 +++++++-- docs/next-env.d.ts | 2 +- .../src/SankeyChart/calculateSankeyLayout.ts | 5 ++- .../src/SankeyChart/sankey.types.ts | 22 +++++++++-- 8 files changed, 161 insertions(+), 28 deletions(-) diff --git a/docs/data/charts/sankey/SankeyLinkSorting.js b/docs/data/charts/sankey/SankeyLinkSorting.js index d4076a3c8c99c..766dcdbbe7759 100644 --- a/docs/data/charts/sankey/SankeyLinkSorting.js +++ b/docs/data/charts/sankey/SankeyLinkSorting.js @@ -29,14 +29,37 @@ export default function SankeyLinkSorting() { >
- Default Link Order + auto (default) - + +
+ +
+ + fixed + +
- Links Sorted by Value + Custom Function
- Default Link Order + auto (default) - + +
+ +
+ + fixed + +
- Links Sorted by Value + Custom Function
- Default Node Order + auto (default) + + +
+ +
+ + fixed - +
- Nodes Sorted Alphabetically + Custom Function
- Default Node Order + auto (default) + + +
+ +
+ + fixed - +
- Nodes Sorted Alphabetically + Custom Function /// -/// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts index f224f0b6b2f9a..3735f6d826d07 100644 --- a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts +++ b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts @@ -63,15 +63,16 @@ export function calculateSankeyLayout( .nodeId((d) => d.id) .iterations(iterations); + // For 'auto' or undefined, don't set anything (use d3-sankey default behavior) if (typeof nodeSort === 'function') { sankeyGenerator.nodeSort(nodeSort); - } else { + } else if (nodeSort === 'fixed') { // Null is not accepted by the types. sankeyGenerator.nodeSort(null as any); } if (typeof linkSort === 'function') { sankeyGenerator.linkSort(linkSort); - } else { + } else if (linkSort === 'fixed') { // Null is not accepted by the types. sankeyGenerator.linkSort(null as any); } diff --git a/packages/x-charts-pro/src/SankeyChart/sankey.types.ts b/packages/x-charts-pro/src/SankeyChart/sankey.types.ts index afef0d0adf7fe..65e4f01fe7feb 100644 --- a/packages/x-charts-pro/src/SankeyChart/sankey.types.ts +++ b/packages/x-charts-pro/src/SankeyChart/sankey.types.ts @@ -90,12 +90,19 @@ export type SankeyNodeOptions = { */ showLabels?: boolean; /** - * Custom sort function for nodes + * Custom sort mode for nodes + * + * - 'auto': Automatic sorting behavior (default) + * - 'fixed': Preserve the order from the nodes array (disables automatic sorting) + * - or a custom function + * * @param {SankeyLayoutNode} a - First node to compare * @param {SankeyLayoutNode} b - Second node to compare * @returns {number} Comparison result + * + * @default 'auto' */ - sort?: (a: SankeyLayoutNode, b: SankeyLayoutNode) => number | null; + sort?: 'auto' | 'fixed' | ((a: SankeyLayoutNode, b: SankeyLayoutNode) => number); } & SankeyNodeHighlightScope; export type SankeyLinkOptions = { @@ -116,12 +123,19 @@ export type SankeyLinkOptions = { */ showValues?: boolean; /** - * Custom sort function for links + * Custom sort mode for links + * + * - 'auto': Automatic sorting behavior (default) + * - 'fixed': Preserve the order from the links array (disables automatic sorting) + * - or a custom function + * * @param {SankeyLayoutLink} a - First link to compare * @param {SankeyLayoutLink} b - Second link to compare * @returns {number} Comparison result + + * @default 'auto' */ - sort?: (a: SankeyLayoutLink, b: SankeyLayoutLink) => number | null; + sort?: 'auto' | 'fixed' | ((a: SankeyLayoutLink, b: SankeyLayoutLink) => number); /** * Applies the given number to the X dimension of the control points of the link's curve function. * This can create better looking links between nodes, but is dependent on the graph layout. From 718a696a26cf9611b14c9136ed9cf7d53ed1254a Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Mon, 10 Nov 2025 12:20:27 +0100 Subject: [PATCH 06/12] fix sorting --- docs/data/charts/sankey/SankeyLinkSorting.js | 10 +++++----- docs/data/charts/sankey/SankeyNodeSorting.js | 4 ++-- docs/data/charts/sankey/SankeyNodeSorting.tsx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/data/charts/sankey/SankeyLinkSorting.js b/docs/data/charts/sankey/SankeyLinkSorting.js index 53e5ebbf084fb..fd63d2ded9e07 100644 --- a/docs/data/charts/sankey/SankeyLinkSorting.js +++ b/docs/data/charts/sankey/SankeyLinkSorting.js @@ -3,12 +3,12 @@ import Typography from '@mui/material/Typography'; const data = { links: [ - { source: 'C', target: 'Y', value: 10 }, - { source: 'A', target: 'X', value: 25 }, - { source: 'B', target: 'X', value: 10 }, - { source: 'X', target: 'Z', value: 25 }, - { source: 'Y', target: 'Z', value: 8 }, { source: 'B', target: 'Y', value: 5 }, + { source: 'Y', target: 'Z', value: 8 }, + { source: 'X', target: 'Z', value: 25 }, + { source: 'B', target: 'X', value: 10 }, + { source: 'A', target: 'X', value: 25 }, + { source: 'C', target: 'Y', value: 10 }, ], }; diff --git a/docs/data/charts/sankey/SankeyNodeSorting.js b/docs/data/charts/sankey/SankeyNodeSorting.js index faaea8f4ca8ab..96e88de1868a4 100644 --- a/docs/data/charts/sankey/SankeyNodeSorting.js +++ b/docs/data/charts/sankey/SankeyNodeSorting.js @@ -4,8 +4,8 @@ import Typography from '@mui/material/Typography'; const data = { nodes: [ { id: 'C' }, - { id: 'A' }, { id: 'B' }, + { id: 'A' }, { id: 'X' }, { id: 'Y' }, { id: 'Z' }, @@ -24,7 +24,7 @@ const data = { const nodeSortFunction = (a, b) => { const labelA = a.label || a.id; const labelB = b.label || b.id; - return labelA.localeCompare(labelB); + return labelB.localeCompare(labelA); }; export default function SankeyNodeSorting() { diff --git a/docs/data/charts/sankey/SankeyNodeSorting.tsx b/docs/data/charts/sankey/SankeyNodeSorting.tsx index 80dbd53068076..6787645feb628 100644 --- a/docs/data/charts/sankey/SankeyNodeSorting.tsx +++ b/docs/data/charts/sankey/SankeyNodeSorting.tsx @@ -24,7 +24,7 @@ const data = { const nodeSortFunction = (a: any, b: any) => { const labelA = a.label || a.id; const labelB = b.label || b.id; - return labelA.localeCompare(labelB); + return labelB.localeCompare(labelA); }; export default function SankeyNodeSorting() { From 1ed9b5eeeba7763df7e3e540d77276fe5a85f629 Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Mon, 10 Nov 2025 12:52:41 +0100 Subject: [PATCH 07/12] remove --- test/regressions/charts/SankeyNodeOrder.tsx | 37 --------------------- 1 file changed, 37 deletions(-) delete mode 100644 test/regressions/charts/SankeyNodeOrder.tsx diff --git a/test/regressions/charts/SankeyNodeOrder.tsx b/test/regressions/charts/SankeyNodeOrder.tsx deleted file mode 100644 index d5db14fc4c98b..0000000000000 --- a/test/regressions/charts/SankeyNodeOrder.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import * as React from 'react'; -import { Unstable_SankeyChart as SankeyChart } from '@mui/x-charts-pro/SankeyChart'; - -const data = { - nodes: [ - { id: 'A' }, - { id: 'B' }, - { id: 'C' }, - { id: 'D' }, - { id: 'E' }, - { id: 'F' }, - { id: 'G' }, - ], - - links: [ - { source: 'A', target: 'F', value: 90 }, - { source: 'B', target: 'F', value: 10 }, - { source: 'C', target: 'G', value: 80 }, - { source: 'D', target: 'G', value: 20 }, - { source: 'E', target: 'G', value: 5 }, - { source: 'F', target: 'H', value: 100 }, - ], -}; - -export default function SankeyIncomeStatement() { - return ( - - ); -} From 007326923f32a732097dade37a48f0215de14a3b Mon Sep 17 00:00:00 2001 From: Jose C Quintas Jr Date: Wed, 12 Nov 2025 11:49:30 +0100 Subject: [PATCH 08/12] Update docs/data/charts/sankey/sankey.md Co-authored-by: Bernardo Belchior Signed-off-by: Jose C Quintas Jr --- docs/data/charts/sankey/sankey.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/data/charts/sankey/sankey.md b/docs/data/charts/sankey/sankey.md index 855c0395f2298..98cfa92ee4dfd 100644 --- a/docs/data/charts/sankey/sankey.md +++ b/docs/data/charts/sankey/sankey.md @@ -121,7 +121,7 @@ It accepts three types of values: The `linkOptions.sort` property controls the order of links emanating from each node. -It accepts the same three types of values: +It accepts the following values: - A **function** that receives two `SankeyLayoutLink` objects and returns a number - `'auto'` (default): Uses the automatic sorting behavior From 6e44c622c99f65b9ce7afc7d7e2603e326f4a83c Mon Sep 17 00:00:00 2001 From: Jose C Quintas Jr Date: Wed, 12 Nov 2025 11:49:39 +0100 Subject: [PATCH 09/12] Update docs/data/charts/sankey/sankey.md Co-authored-by: Bernardo Belchior Signed-off-by: Jose C Quintas Jr --- docs/data/charts/sankey/sankey.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/data/charts/sankey/sankey.md b/docs/data/charts/sankey/sankey.md index 98cfa92ee4dfd..1158b568da1e2 100644 --- a/docs/data/charts/sankey/sankey.md +++ b/docs/data/charts/sankey/sankey.md @@ -109,7 +109,7 @@ To dynamically customize the order, use the sorting functions for the element th The `nodeOptions.sort` property controls the vertical order of nodes within each column. -It accepts three types of values: +It accepts the following values: - A **function** that receives two `SankeyLayoutNode` objects and returns a number (similar to [`Array.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#comparefn)) - `'auto'` (default): Uses the automatic sorting behavior From cb7ca8d169297725dcbfee2a1d2f52f37618f01b Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Wed, 12 Nov 2025 11:53:55 +0100 Subject: [PATCH 10/12] suggestion --- docs/data/charts/sankey/sankey.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/data/charts/sankey/sankey.md b/docs/data/charts/sankey/sankey.md index 1158b568da1e2..049f5d35106ec 100644 --- a/docs/data/charts/sankey/sankey.md +++ b/docs/data/charts/sankey/sankey.md @@ -112,7 +112,7 @@ The `nodeOptions.sort` property controls the vertical order of nodes within each It accepts the following values: - A **function** that receives two `SankeyLayoutNode` objects and returns a number (similar to [`Array.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#comparefn)) -- `'auto'` (default): Uses the automatic sorting behavior +- `'auto'` (default): Uses the automatic sorting behavior, which aims to minimize links crossing each other - `'fixed'`: Preserves the order from the `nodes` array, disabling automatic sorting {{"demo": "SankeyNodeSorting.js"}} @@ -124,7 +124,7 @@ The `linkOptions.sort` property controls the order of links emanating from each It accepts the following values: - A **function** that receives two `SankeyLayoutLink` objects and returns a number -- `'auto'` (default): Uses the automatic sorting behavior +- `'auto'` (default): Uses the automatic sorting behavior, which aims to minimize links crossing each other - `'fixed'`: Preserves the order from the `links` array, disabling automatic sorting {{"demo": "SankeyLinkSorting.js"}} From 3cc8199719049adc1797d7d4c38aeb5b14438930 Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Wed, 12 Nov 2025 12:01:10 +0100 Subject: [PATCH 11/12] more distinct auto/fixed --- docs/data/charts/sankey/SankeyLinkSorting.js | 6 +++--- docs/data/charts/sankey/SankeyLinkSorting.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/data/charts/sankey/SankeyLinkSorting.js b/docs/data/charts/sankey/SankeyLinkSorting.js index fd63d2ded9e07..86cdd918bf9a9 100644 --- a/docs/data/charts/sankey/SankeyLinkSorting.js +++ b/docs/data/charts/sankey/SankeyLinkSorting.js @@ -3,12 +3,12 @@ import Typography from '@mui/material/Typography'; const data = { links: [ + { source: 'C', target: 'Y', value: 10 }, + { source: 'B', target: 'X', value: 10 }, { source: 'B', target: 'Y', value: 5 }, - { source: 'Y', target: 'Z', value: 8 }, { source: 'X', target: 'Z', value: 25 }, - { source: 'B', target: 'X', value: 10 }, + { source: 'Y', target: 'Z', value: 8 }, { source: 'A', target: 'X', value: 25 }, - { source: 'C', target: 'Y', value: 10 }, ], }; diff --git a/docs/data/charts/sankey/SankeyLinkSorting.tsx b/docs/data/charts/sankey/SankeyLinkSorting.tsx index 0633fab8b0f3e..88c7fe12d9659 100644 --- a/docs/data/charts/sankey/SankeyLinkSorting.tsx +++ b/docs/data/charts/sankey/SankeyLinkSorting.tsx @@ -3,12 +3,12 @@ import Typography from '@mui/material/Typography'; const data = { links: [ + { source: 'C', target: 'Y', value: 10 }, + { source: 'B', target: 'X', value: 10 }, { source: 'B', target: 'Y', value: 5 }, - { source: 'Y', target: 'Z', value: 8 }, { source: 'X', target: 'Z', value: 25 }, - { source: 'B', target: 'X', value: 10 }, + { source: 'Y', target: 'Z', value: 8 }, { source: 'A', target: 'X', value: 25 }, - { source: 'C', target: 'Y', value: 10 }, ], }; From fec5c91525607fc671815cc4bc71747a4115c2ee Mon Sep 17 00:00:00 2001 From: Jose Quintas Date: Wed, 12 Nov 2025 12:03:47 +0100 Subject: [PATCH 12/12] add gh pr link --- packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts index 3735f6d826d07..befd3f8adb613 100644 --- a/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts +++ b/packages/x-charts-pro/src/SankeyChart/calculateSankeyLayout.ts @@ -68,6 +68,7 @@ export function calculateSankeyLayout( sankeyGenerator.nodeSort(nodeSort); } else if (nodeSort === 'fixed') { // Null is not accepted by the types. + // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73953 sankeyGenerator.nodeSort(null as any); } if (typeof linkSort === 'function') {