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

feat(docs): labels spec update #6647

Open
wants to merge 4 commits into
base: v5
Choose a base branch
from
Open

feat(docs): labels spec update #6647

wants to merge 4 commits into from

Conversation

ai-qing-hai
Copy link
Collaborator

更新 组件 label 标签文本

image

Copy link

Walkthrough: 本次更新主要涉及组件标签文本的更新,特别是对 G2 数据标签(Label)的使用和配置进行了详细的说明和示例更新。通过增加新的内容和示例,帮助用户更好地理解和使用标签功能。

Changes:

文件 概要
site/docs/manual/component/label.zh.md 更新了 G2 数据标签的文档,增加了概述、元素、使用/配置方式等章节,提供了详细的 API 和 spec 配置示例,并更新了标签转换和选择器的说明。

@coveralls
Copy link

coveralls commented Mar 12, 2025

Pull Request Test Coverage Report for Build 13855277586

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 35 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.007%) to 86.697%

Files with Coverage Reduction New Missed Lines %
src/api/runtime.ts 1 98.45%
src/utils/helper.ts 8 89.87%
src/interaction/tooltip.ts 26 91.2%
Totals Coverage Status
Change from base Build 13853281457: 0.007%
Covered Lines: 10630
Relevant Lines: 11886

💛 - Coveralls

@ai-qing-hai ai-qing-hai changed the title [WIP](docs): labels spec update feat(docs): labels spec update Mar 13, 2025

```js
// API 方式
// 第一种方式
// 第一种方式 label 分别配置 传入对象
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在G2的文档里不用介绍api模式了,后面会专门出一篇文档介绍。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除

],
});
```
G2 中**数据标签(Label)** 是给图表添加标注的手段之一,对当前的一组数据进行的内容标注。包括数据点、拉线、文本数值等元素,根据不同的图表类型选择使用。通过简洁的文字说明,减少误解,使图表更易解读,并且强调关键数据或趋势,引导关注重要信息。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g2 plot的这个拉线有点太抽象了,统一改成连接线吧,更好懂一点

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

| style | 标签样式配置 | [style](#style) | - | |
| background| 是否展示背景颜色 | _boolean_ | - | |
| formatter | 标签文本格式化 | _string_ \| _Function\<string\>_ | - | |
| connector | 是否展示连接线 在 饼图和环形图等非笛卡尔坐标系下使用 | _boolean_ | - | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的background和connector其实都是单独的图形,有单独的配置和样式,在最外层也可以配置,我看你写在style里面了,层级有点深,可以参考这两个的写法,在配置项表格列出来,层级结构更清晰一点,然后下面详细介绍。
image
因为形状的属性都是名字+属性名,如果直接列有些用户还是看不懂,大模型也会理解错误。最好罗列一下~
image
然后用一个代码块展示一下配置的层级~
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改, 我直接用示例应该也差不多


不同的转化类型,针对不同的标签问题情况。所以明确每个 `transform` 标签转化的区别十分有必要。

#### overlapDodgeY
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overlapDodgeY的属性漏掉了!~
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

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.

3 participants