Skip to content

Conversation

@JCQuintas
Copy link
Member

@JCQuintas JCQuintas self-assigned this Oct 22, 2025
@JCQuintas JCQuintas added the type: bug It doesn't behave as expected. label Oct 22, 2025
@JCQuintas JCQuintas added the scope: charts Changes related to the charts. label Oct 22, 2025
@mui-bot
Copy link

mui-bot commented Oct 22, 2025

Deploy preview: https://deploy-preview-20065--material-ui-x.netlify.app/

Updated pages:

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 🔺+74B(+0.02%) 🔺+18B(+0.01%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 32dd471

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 22, 2025

CodSpeed Performance Report

Merging #20065 will not alter performance

Comparing JCQuintas:fully-respect-node-order (32dd471) with master (e8522b1)1

Summary

✅ 12 untouched
🆕 1 new

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
🆕 Simulation SankeyChart with big data amount N/A 134.7 ms N/A

Footnotes

  1. No successful run was found on master (e7ad70b) during the generation of this report, so e8522b1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

if (nodeSort) {
sankeyGenerator = sankeyGenerator.nodeSort(nodeSort);
}
sankeyGenerator = sankeyGenerator.nodeSort(defaultNodeSort);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need to get back the returned value.

Suggested change
sankeyGenerator = sankeyGenerator.nodeSort(defaultNodeSort);
sankeyGenerator.nodeSort(defaultNodeSort);

I gave a look at the D3 code, and it look like nodeSort is just a getter if no arguments, and a setter if args are provided.

sankey.nodeSort = function(_) {
  return arguments.length ? (sort = _, sankey) : sort;
};

By the way do wee need that. According to the docs, you should be able to do sankeyGenerator.nodeSort(null); for the same result.

If sort is null, the order is fixed by the input. Otherwise, the specified sort function determines the order;
https://github.com/d3/d3-sankey/tree/master?tab=readme-ov-file#sankey_nodeSort

The sort function you set with sankey.nodeSort appears 3 time in the code

// in relaxLeftToRight()
if (sort === undefined) column.sort(ascendingBreadth);

// in relaxRightToLeft()
if (sort === undefined) column.sort(ascendingBreadth);

// in computeNodeLayers
if (sort) for (const column of columns) {
  column.sort(sort);
}

From what I understand, if not defined, the sankey tries to move nodes the best they can with ascendingBreadth

If sort is not undefined, they sort columns according to the sort function.

And so if the sort is null (or false) it's not equal to undefined and it's falsy so the scritp never touch to the column node order :)

Should we have a boolean parameter to keep the ascendingBreadth behavior? For exampel the node sort function coudl get values 'auto' or 'fix' corresponding respectively to undefined and null in D3

Becasue the result of node placement automatisation is not that bad when looking at argos

image image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way do wee need that. According to the docs, you should be able to do sankeyGenerator.nodeSort(null); for the same result.

True, just the types don't accept that.

My initial intention (current behaviour) was to always use null, but then I was doing if nodeSort check, which would always ignore the null value 😆

I don't think the "auto" is any better than the null and it more often than not is produces exactly the same result.

In the end if the user wants a specific behaviour they can set it themselves.

Now the code should always be null or function, and should fix the ordering issues.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm... I skipped the null previously because if both are null then the linkSort doesn't usually work. 😆

Copy link
Member

@alexfauquette alexfauquette Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end if the user wants a specific behaviour they can set it themselves.

Except if the sankey data come from a database that does not care about the layout. When looking at argos screen shot before looks better than after this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When looking at argos screen shot before looks better than after this PR

Yeah cause:

Nvm... I skipped the null previously because if both are null then the linkSort doesn't usually work. 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll find a better solution 😆

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 3, 2025
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: out-of-date The pull request has merge conflicts and can't be merged. scope: charts Changes related to the charts. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants