antvis/G2

更新关闭 label 的文档 #5918

YY88Xu posted onGitHub

问题描述

<img width="182" alt="image" src="https://github.com/antvis/G2/assets/14836228/331dc883-673f-479f-8ea4-9b6ec8c10fa8"> <img width="189" alt="image" src="https://github.com/antvis/G2/assets/14836228/6e858e54-582a-4410-b34e-511e22952e46"> 通过点击 checkbox 控制 interval 显示 label const totalHCInterval = eeChart.getNodesByType('interval')[1] totalHCInterval.label({ text: 'TotalHc', // 指定绑定的字段 fill: '#ffffff', fontSize: 12, position: 'bottom', }) 再次点击 checkbox 控制 interval 不显示 label const totalHCInterval = eeChart.getNodesByType('interval')[1] totalHCInterval.label(false) 不行

重现链接

No response

重现步骤

No response

预期行为

No response

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


提供一下复现 demo 以及把问题描述得更清楚一点?

posted by pearmini over 1 year ago

<img width="1341" alt="image" src="https://github.com/antvis/G2/assets/14836228/9a66ef60-9332-40d3-90de-07c8cd538999"> 通过这个 checkbox 控制下面是否显示数值,第一次点击可以显示数值,怎么控制取消 checkbox 选中的时候,数值消失呢?

posted by YY88Xu over 1 year ago

`const totalHCInterval = eeChart.getNodesByType('interval')[1]

totalHCInterval.label({ text: 'TotalHc', fill: '#ffffff', fontSize: 12, position: 'bottom', })`

posted by YY88Xu over 1 year ago

试试这样 totalHCInterval.label([])

posted by pearmini over 1 year ago

可以了,感谢。还想问一下怎么看全部的 API 呢?比如mark.label([]) 这种,如果不提 issue, 怎么自己查找 api 然后解决呢? 官网的 api 不够用呢,并且看源码也看不出 mark.label([]) 这种用法呢

posted by YY88Xu over 1 year ago

因为 G2 的 API 较多,也较杂,所以可能会有一些遗漏。一种方法就是有人提问之后,把这个问题的答案更新上去,方便后续的开发者看。

你感兴趣提个 PR 这个问题的解法写在 label 相关的文档中吗 🤣?

posted by pearmini over 1 year ago

那我先把这个 issue 指派给你哈,等你忙完了记得添加一下哦 😄,可以算 AntV OSCP 的一个初级任务。

posted by pearmini over 1 year ago

@YY88Xu 哈喽,这个问题有提交 pr 的计划和进展吗?

posted by hustcc 8 months ago

Fund this Issue

$0.00
Funded

Pull requests