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 数据标签支持富文本格式 #5133

Closed
hustcc opened this issue Jun 1, 2023 · 6 comments
Closed

【特性】label 数据标签支持富文本格式 #5133

hustcc opened this issue Jun 1, 2023 · 6 comments
Assignees

Comments

@hustcc
Copy link
Member

hustcc commented Jun 1, 2023

image

@hustcc hustcc self-assigned this Jun 8, 2023
@hustcc
Copy link
Member Author

hustcc commented Jun 8, 2023

chart
  .interval()
  .encode('x', 'x')
  .encode('y', 'y')
  .label({
    render: (text, datum) => { return 'hello world'; }  // 👈🏻
  })

@pearmini
Copy link
Member

pearmini commented Jun 8, 2023

可以和 tooltip.render 保持一致的返回值:string | HTMLElement

@stillsilly
Copy link

请教一下,quickBI 的这个效果是用 annotation 做的还是用自定义 label 做的
image

@stillsilly
Copy link

stillsilly commented Jun 30, 2023

我有个类似的需求,刚刚想用自定义 label 做,看了下 label 的源码,发现 label 的 content 可以传 group 或者 shape。
然后试了下,直接生成一个 group,加 2 个不同样式的 text shape,传给 content,可以实现这个效果。
(写在这里,以供后来有类似问题的人参考,https://codesandbox.io/s/laughing-ramanujan-mwv7vr

还是有点好奇,quickBI是用啥做的

@hustcc
Copy link
Member Author

hustcc commented Jun 30, 2023

可以看看 dom 结构,只有两种方案,不是 html label 就是和你一样的方案。

@stillsilly
Copy link

好的 谢谢

@hustcc hustcc mentioned this issue Jul 28, 2023
5 tasks
@hustcc hustcc closed this as completed Aug 4, 2023
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

No branches or pull requests

3 participants