antvis/G2
posted by hustcc almost 2 years ago
posted by pearmini almost 2 years ago
posted by stillsilly almost 2 years ago
posted by stillsilly almost 2 years ago
posted by hustcc almost 2 years ago
posted by stillsilly almost 2 years ago
The issue has been closed
【特性】label 数据标签支持富文本格式 #5133
hustcc posted onGitHub
chart
.interval()
.encode('x', 'x')
.encode('y', 'y')
.label({
render: (text, datum) => { return 'hello world'; } // 👈🏻
})
可以和 tooltip.render 保持一致的返回值:string | HTMLElement
请教一下,quickBI 的这个效果是用 annotation 做的还是用自定义 label 做的
我有个类似的需求,刚刚想用自定义 label 做,看了下 label 的源码,发现 label 的 content 可以传 group 或者 shape。 然后试了下,直接生成一个 group,加 2 个不同样式的 text shape,传给 content,可以实现这个效果。 (写在这里,以供后来有类似问题的人参考,https://codesandbox.io/s/laughing-ramanujan-mwv7vr )
还是有点好奇,quickBI是用啥做的
可以看看 dom 结构,只有两种方案,不是 html label 就是和你一样的方案。
好的 谢谢