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

脑图改进,避免节点被标签遮挡;当光标悬浮于某节点时,高亮其对应的label #11461

Closed
wants to merge 5 commits into from

Conversation

iamqiz
Copy link
Contributor

@iamqiz iamqiz commented May 19, 2024

  • Please commit to the dev branch
  • For contributing new features, please supplement and improve the corresponding user guide documents
  • For bug fixes, please describe the problem and solution via code comments
  • For text improvements (such as typos and wording adjustments), please submit directly
    问题出处:
    https://ld246.com/article/1715499734408
    修改前后对比:
    Clip_2024-05-19_16-31-27
    动画演示
    recording

24-05-20 更新: 效果见 #11461 (comment)

@iamqiz
Copy link
Contributor Author

iamqiz commented May 19, 2024

上面的修改还是可能会导致节点被label遮挡,
我想到其它2种方案,如下,
默认限制label的宽度,并使多出的字符显示为"..." (见下图),当光标悬停时解除限制; 但是这也有缺点,即如果树很浅,不限制宽度就能完全显示完整的label, 这时却限制宽度,就没必要

Clip_2024-05-19_17-56-48

另外,如果限制宽度,且使其显示完整的label (见下图),那么label会很高,导致其可能会遮挡上下的兄弟节点

Clip_2024-05-19_17-55-21

所以,这些方案都不完美
我研究了echarts文档,没找到能完美解决的选项😹

@iamqiz
Copy link
Contributor Author

iamqiz commented May 19, 2024

@Vanessa219 @Zuoqiu-Yingyi 大佬怎么看?

@iamqiz iamqiz closed this May 19, 2024
@iamqiz
Copy link
Contributor Author

iamqiz commented May 20, 2024

允许在空白处双击, 然后在宽度限制模式和非限制模式之间切换
recording

@iamqiz iamqiz reopened this May 20, 2024
@TCOTC
Copy link
Contributor

TCOTC commented May 20, 2024

既然鼠标悬浮的时候可以展开了,那宽度也应该相应变大:

image

@iamqiz
Copy link
Contributor Author

iamqiz commented May 20, 2024

@TCOTC 代码上我实现不了,在宽度限制模式下,label有个width属性,值我设为了50,要想让其宽度自适应,需要设置为undefined,
这在双击事件中更新配置可以生效,但是在初始的配置中(调用setOption())中无效, 因此光标悬停时宽度无法自适应,
因此,会出现下面两种情况
1.保持宽度限制,多余的文本的背景色会是透明的,导致看不清

Clip_2024-05-20_13-57-07

  1. 宽度自定义为一个很大的值,比如500,那么会产生多余的背景,看着丑
    Clip_2024-05-20_13-59-10

@Vanessa219
Copy link
Member

节点少了,在上面不好看呀,还有为啥是粉色?

@iamqiz iamqiz closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants