Skip to content

fix: sankey related emphasis throws on plain node-link data - #4709

Merged
xile611 merged 2 commits into
VisActor:developfrom
dyk1454683243-sudo:cursor/sankey-related-emphasis-787d
Oct 16, 2026
Merged

xile611 merged 2 commits into
VisActor:developfrom
dyk1454683243-sudo:cursor/sankey-related-emphasis-787d

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🤔 This is a ...

  • Bug fix
  • New feature
  • 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

Fixes #4707

The same plain node-link path is what #4305 depends on. A reduced numeric source/target graph with a path longer than two hops now highlights the full upstream and downstream path on hover.

🔗 Related PR link

None.

🐞 Bugserver case id

Not applicable. This fix comes from the GitHub issue, not a BugServer case.

💡 Background and solution

Hovering a node or a link on a plain nodes / links sankey with emphasis: { enable: true, trigger: 'hover', effect: 'related' } threw during interaction. The initial render was fine.

Root cause:

  • Node traversal still read nodeElement.data[0]. Mark graphics keep the datum on context, and the other sankey paths read it with getDatumOfGraphic.
  • Link traversal treated any existing datum as hierarchical data, then read .length of a missing parents array. The plain-graph branch never ran, and that branch only cleared states.
  • The old plain-node walk also stopped after one extra hop and queued the wrong link list, so a path longer than two hops was incomplete.

Fix:

  • Treat a link as hierarchical only when its datum has parents.
  • For plain node-link data, walk outgoing links downstream and incoming links upstream from the rendered link datums, then apply the emphasis and reverse states.
  • Leave the hierarchical parents ratio path unchanged.

📝 Changelog

Language Changelog
🇺🇸 English Fix sankey emphasis.effect: 'related' throwing on plain node-link data, and highlight the full upstream and downstream path on node or link hover.
🇨🇳 Chinese 修复普通 nodes/links 桑基图在 emphasis.effect: 'related' 时悬停节点或边抛错的问题,并正确高亮上下游整条路径。

☑️ Self-Check before Merge

  • 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

@visactor-review-bot visactor-review-bot Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Latest reviewed commit: ba90065

No confirmed new issues found.

Comment thread packages/vchart/src/series/sankey/sankey.ts Outdated
@xile611

xile611 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@dyk1454683243-sudo 需要rebase 一下最新的develop

cursoragent and others added 2 commits October 16, 2026 06:31
Plain node and link hover with effect "related" read graphic.data and a missing parents list. Walk upstream and downstream from the rendered link datums instead, and keep the hierarchical parents path unchanged.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
Plain related emphasis already tracks reachable nodes in a Set.
Pass that Set to _highLightElements so state selection is not
O(V^2) on large graphs. Hierarchical parents callers still pass arrays.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/sankey-related-emphasis-787d branch from 1fd2d52 to ba90065 Compare October 16, 2026 06:31
@xile611
xile611 merged commit 1a53199 into VisActor:develop Oct 16, 2026
8 of 9 checks passed
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.

[Bug] Sankey related hover throws TypeError for nodes and links in 2.1.7

3 participants