Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望提供自定义树布局和递归渲染的能力 #2780

Closed
jiankafei opened this issue Oct 18, 2022 · 5 comments
Closed

希望提供自定义树布局和递归渲染的能力 #2780

jiankafei opened this issue Oct 18, 2022 · 5 comments
Labels
type: feature 新功能 Feature/enhancement requests

Comments

@jiankafei
Copy link

jiankafei commented Oct 18, 2022

功能描述

提供一个自定义树布局渲染接口,接口包含以下几个方面:

  1. 提供渲染数据
  2. 自定义兄弟节点之间的连接方式
  3. 自定义父子之间的连接方式
  4. 对有children属性的节点进行递归渲染
  5. 节点之间的距离内部自动计算

如此,即可实现用户自定义树布局的渲染。用户不用去费劲处理children的渲染逻辑。

期望解决方案

graph.customTreeRender({
  startX: 100,
  startY: 100,
  data: [
    { shap: '', labelText: '', children: [
       { shap: '', labelText: '', children: [] }
    ] },
    { shap: '', labelText: '', children: [
       { shap: '', labelText: '', children: [] }
    ] },
  ],
  renderNode: (data, startPos) => {}, // 返回一个node节点
  toBrotherEdge: (brData1, brData2) => {}, // 返回兄弟节点间的edge或null
  toChildEdge: (parentData, childData) => {}, // 返回父子间的一个edge或null
  childrenAlignToParent: 'top', // top, bottom, middle, left, right, center, 定义子列相对于父节点的位置
  offset: [x, y], // 定义在childrenAlignToParent基础上子列的相对偏移量
  rankSep: () => {}, // 层间距
  nodeBaseSep: () => {}, // 节点基础间距
  canCollapse: true|false, //是否可以收起展开
  frozenLayout: true|false, // 是否冻结布局
});
@x6-bot
Copy link
Contributor

x6-bot bot commented Oct 18, 2022

👋 @jiankafei

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@NewByVector
Copy link
Contributor

非常好的建议,我们考虑后面会加在 layout 插件中。

@NewByVector NewByVector added the type: feature 新功能 Feature/enhancement requests label Oct 25, 2022
@NewByVector
Copy link
Contributor

#2972 重复。

@yjz321
Copy link

yjz321 commented Jan 17, 2024

@NewByVector 请问目前插件中有实现这块功能吗

@x6-bot
Copy link
Contributor

x6-bot bot commented Jan 17, 2025

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature 新功能 Feature/enhancement requests
Projects
None yet
Development

No branches or pull requests

3 participants