Skip to content

Feat/compare sankey chart#4119

Open
xuefei1313 wants to merge 7 commits intodevelopfrom
feat/compare-sankey-chart
Open

Feat/compare sankey chart#4119
xuefei1313 wants to merge 7 commits intodevelopfrom
feat/compare-sankey-chart

Conversation

@xuefei1313
Copy link
Contributor

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Release
  • Site / documentation update
  • Demo update
  • Workflow
  • Other (about what?)

🔗 Related issue link

🔗 Related PR link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

@xuefei1313 xuefei1313 changed the title [WIP]Feat/compare sankey chart Feat/compare sankey chart Sep 19, 2025
Copy link
Contributor Author

@xuefei1313 xuefei1313 left a comment

Choose a reason for hiding this comment

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

整体实现逻辑清晰,充分利用了 VChart 的扩展机制。但有以下建议:

  1. 完善测试:该功能涉及复杂的布局和交互逻辑,建议在 __tests__ 中增加相应的单元测试或集成测试。
  2. 文档与示例:建议补充该图表类型的数据结构说明(特别是 subNode 的组织方式)以及对应的 Demo 示例。
  3. 交互性能:在 _handleNodeRelatedClick 中存在较多的大数组遍历和 getDatumOfGraphic 调用,对于数据量较大的场景可能存在性能隐患,建议关注。

const sourceNode = nodeDatum.sourceNode;
// 上游路径始终只选取第一个
const firstTarget = sourceNode.targetLinks[0];
if (!firstTarget) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里只选取了第一个 targetLink 进行处理。在桑基图中,一个节点可能有多个输入边。如果只取第一个,是否会丢失其他输入路径的对比信息?建议确认此处逻辑。

// 同时需要清除 hover
const allNodeElements = this._nodeMark.getGraphics();
if (allNodeElements || !allNodeElements.length) {
allNodeElements.forEach(el => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

此处的判断条件 allNodeElements || !allNodeElements.length 逻辑上有些奇怪。通常应该是 if (allNodeElements && allNodeElements.length)。目前的写法在 allNodeElements 为空数组时也会进入。

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants