antvis/G6

树状布局TB状态下,子节点希望可以支持自定义布局 #5062

KTBOY posted onGitHub

问题描述

这段代码对子节点自定义布局没有效果 treeGraph.node(function (node) { return { label: node.id, labelCfg: { offset: 10, position: node.children && node.children.length > 0 ? "" : "right" } }; });

重现链接

https://codesandbox.io/embed/sleepy-khorana-8jqxhd?fontsize=14&hidenavigation=1&theme=dark

重现步骤

1.点击进行页面 2.搜索treeGraph.node

预期行为

类似实现效果图1:image

效果图2:https://user-images.githubusercontent.com/52773276/274475868-e0f9f42c-5992-44c6-9fe7-bf6e0297d88d.png

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


Hi @KTBOY, Please star this repo if you find it useful! Thanks :star:! 你好 @KTBOY。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

posted by github-actions[bot] over 1 year ago

hi @KTBOY, welcome!

posted by github-actions[bot] over 1 year ago

树图的自定义布局可以这么做:https://codesandbox.io/s/ecstatic-phoebe-95kxjg

posted by Yanyan-Wang over 1 year ago

还是这样,多谢大佬了

posted by KTBOY over 1 year ago

树图的自定义布局可以这么做:https://codesandbox.io/s/ecstatic-phoebe-95kxjg

求问,如果我想从depth=2的节点开始应用缩进树的配置应该怎么修改?

posted by zhangyang-igloo over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests