Skip to content

docs: add common configuration link#3005

Merged
lxfu1 merged 3 commits into
v2from
docs/common
Jun 30, 2025
Merged

docs: add common configuration link#3005
lxfu1 merged 3 commits into
v2from
docs/common

Conversation

@lxfu1
Copy link
Copy Markdown
Member

@lxfu1 lxfu1 commented Jun 30, 2025

Summary by CodeRabbit

  • 文档
    • 在各类图表组件的“配置项”部分新增了指向通用配置项的参考链接,便于用户查阅通用属性说明。
    • 部分示例代码由底层 G2 API 改为基于 React 的 @ant-design/plots 组件写法,提升了示例的现代化与易用性。
    • 删除了动画关键帧相关的英文代码示例。
    • 优化了滑块(slider)和序数比例尺(ordinal scale)等示例,采用 React 组件方式,增强了文档一致性。
    • 修正了 Bullet 图表文档中目标颜色配置项的键名由单数改为复数,提升文档准确性。

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 30, 2025

📝 Walkthrough

Walkthrough

本次更新主要在各类图表组件的中文文档“配置项”部分,统一新增了一行通用属性参考链接,指向通用配置项的总览页面。此外,部分配置示例代码由底层 G2 API 改为使用更高层的 React 组件(如 Line、Column),代码风格更现代化,使用了 React 的函数式组件和 createRoot 渲染方式。

Changes

文件/文件组 变更摘要
site/docs/components/plots/*.zh.md 在“配置项”部分统一新增“通用属性参考:通用配置”链接,无其他内容变更。
site/docs/components/plots/bullet.zh.md 除新增通用属性参考链接外,修正 target 颜色配置项名为 targets。
site/docs/options/plots/animate/overview.en.md 移除了 keyframe 动画的完整代码示例。
site/docs/options/plots/interaction/brushHighlight.zh.md 示例代码从 G2 Chart API 改为 React 组件 Line,使用函数式组件和 createRoot 渲染。
site/docs/options/plots/scale/ordinal.zh.md 示例代码由 G2 Chart API 改为 React 组件 Column,采用声明式写法。
site/docs/options/plots/slider.zh.md 示例代码由 G2 Chart API 改为 React 组件 Line,事件监听逻辑迁移到 onReady 回调。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docs
    participant ReactComponent

    User->>Docs: 打开配置项文档
    Docs->>User: 展示配置项内容
    Docs-->>User: 提供“通用配置”链接
    User->>Docs: 查看代码示例
    Docs->>ReactComponent: 加载 React 示例组件
    ReactComponent->>User: 渲染图表(如 Line/Column)
Loading

Possibly related PRs

Poem

🐇
文档添新链,通用配置现。
React 组件舞,示例更直观。
代码焕新颜,学习更轻松。
兔子敲键盘,知识乐无穷!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4f2f3 and 5daba5a.

📒 Files selected for processing (27)
  • site/docs/components/plots/area.zh.md (1 hunks)
  • site/docs/components/plots/bar.zh.md (1 hunks)
  • site/docs/components/plots/bidirectional-bar.zh.md (1 hunks)
  • site/docs/components/plots/box.zh.md (1 hunks)
  • site/docs/components/plots/bullet.zh.md (2 hunks)
  • site/docs/components/plots/circle-packing.zh.md (1 hunks)
  • site/docs/components/plots/column.zh.md (1 hunks)
  • site/docs/components/plots/dual-axes.zh.md (1 hunks)
  • site/docs/components/plots/funnel.zh.md (1 hunks)
  • site/docs/components/plots/gauge.zh.md (1 hunks)
  • site/docs/components/plots/heatmap.zh.md (1 hunks)
  • site/docs/components/plots/histogram.zh.md (1 hunks)
  • site/docs/components/plots/line.zh.md (1 hunks)
  • site/docs/components/plots/liquid.zh.md (1 hunks)
  • site/docs/components/plots/pie.zh.md (1 hunks)
  • site/docs/components/plots/radar.zh.md (1 hunks)
  • site/docs/components/plots/radial-bar.zh.md (1 hunks)
  • site/docs/components/plots/rose.zh.md (1 hunks)
  • site/docs/components/plots/sankey.zh.md (1 hunks)
  • site/docs/components/plots/scatter.zh.md (1 hunks)
  • site/docs/components/plots/stock.zh.md (1 hunks)
  • site/docs/components/plots/sunburst.zh.md (1 hunks)
  • site/docs/components/plots/treemap.zh.md (1 hunks)
  • site/docs/components/plots/venn.zh.md (1 hunks)
  • site/docs/components/plots/violin.zh.md (1 hunks)
  • site/docs/components/plots/waterfall.zh.md (1 hunks)
  • site/docs/components/plots/word-cloud.zh.md (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • site/docs/components/plots/sankey.zh.md
  • site/docs/components/plots/gauge.zh.md
  • site/docs/components/plots/dual-axes.zh.md
🚧 Files skipped from review as they are similar to previous changes (24)
  • site/docs/components/plots/funnel.zh.md
  • site/docs/components/plots/bullet.zh.md
  • site/docs/components/plots/line.zh.md
  • site/docs/components/plots/scatter.zh.md
  • site/docs/components/plots/waterfall.zh.md
  • site/docs/components/plots/word-cloud.zh.md
  • site/docs/components/plots/bar.zh.md
  • site/docs/components/plots/area.zh.md
  • site/docs/components/plots/circle-packing.zh.md
  • site/docs/components/plots/pie.zh.md
  • site/docs/components/plots/venn.zh.md
  • site/docs/components/plots/radar.zh.md
  • site/docs/components/plots/radial-bar.zh.md
  • site/docs/components/plots/histogram.zh.md
  • site/docs/components/plots/heatmap.zh.md
  • site/docs/components/plots/box.zh.md
  • site/docs/components/plots/stock.zh.md
  • site/docs/components/plots/rose.zh.md
  • site/docs/components/plots/bidirectional-bar.zh.md
  • site/docs/components/plots/sunburst.zh.md
  • site/docs/components/plots/treemap.zh.md
  • site/docs/components/plots/liquid.zh.md
  • site/docs/components/plots/column.zh.md
  • site/docs/components/plots/violin.zh.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: deploy
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch docs/common

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 21

♻️ Duplicate comments (4)
site/docs/components/plots/gauge.zh.md (1)

44-45: 同上:请使用绝对路径并验证锚点

venn.zh.md 中的意见一致。
参见该文件的修改建议。

site/docs/components/plots/sankey.zh.md (1)

41-42: 同上:请使用绝对路径并验证锚点

venn.zh.md 中的意见一致。
参见该文件的修改建议。

site/docs/components/plots/area.zh.md (1)

65-66: 同上:请使用绝对路径并验证锚点

venn.zh.md 中的意见一致。
参见该文件的修改建议。

site/docs/components/plots/radar.zh.md (1)

45-46: 同上:请使用绝对路径并验证锚点

venn.zh.md 中的意见一致。
参见该文件的修改建议。

🧹 Nitpick comments (3)
site/docs/components/plots/bullet.zh.md (1)

43-44: 链接路径需统一为绝对路径

此前文档中的内部链接均以 / 开头(如上方的 /examples#statistics-bullet/options/plots/title 等)。这里缺少前导 /,可能导致在某些部署环境下解析为相对路径而 404。建议保持一致性。

-通用属性参考:[通用配置](components/plots/overview#通用配置项)
+通用属性参考:[通用配置](/components/plots/overview#通用配置项)
site/docs/components/plots/scatter.zh.md (1)

47-48: 统一链接写法,避免路由解析异常

前面同一文件已有 "/examples#statistics-scatter" 这种以 / 开头的绝对路径,而此处漏掉了 /,容易在某些路由器或部署路径下解析成相对地址导致 404。建议保持一致写绝对路径。

-通用属性参考:[通用配置](components/plots/overview#通用配置项)
+通用属性参考:[通用配置](/components/plots/overview#通用配置项)
site/docs/options/plots/slider.zh.md (1)

338-346: DOM 选择器过于宽泛,示例在多 Slider 场景下可能失效

document.querySelector('.slider') 仅返回首个匹配节点,若页面同时存在多个图表/缩略轴将捕获到错误实例。
建议限定到当前图表容器,或直接使用 G2 事件,而不依赖 DOM:

-document.querySelector('.slider').addEventListener('valuechange', (evt) => {
-  console.info(evt.detail);
-});
+const slider = chart.getContainer().querySelector('.slider');
+slider?.addEventListener('valuechange', (evt) => {
+  console.info(evt.detail);
+});

如果 G2 已暴露 slider:valuechange 事件,可进一步精简为:

chart.on('slider:valuechange', ({ range }) => console.info(range));
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e71c805 and 9f40c7c.

📒 Files selected for processing (31)
  • site/docs/components/plots/area.zh.md (1 hunks)
  • site/docs/components/plots/bar.zh.md (1 hunks)
  • site/docs/components/plots/bidirectional-bar.zh.md (1 hunks)
  • site/docs/components/plots/box.zh.md (1 hunks)
  • site/docs/components/plots/bullet.zh.md (1 hunks)
  • site/docs/components/plots/circle-packing.zh.md (1 hunks)
  • site/docs/components/plots/column.zh.md (1 hunks)
  • site/docs/components/plots/dual-axes.zh.md (1 hunks)
  • site/docs/components/plots/funnel.zh.md (1 hunks)
  • site/docs/components/plots/gauge.zh.md (1 hunks)
  • site/docs/components/plots/heatmap.zh.md (1 hunks)
  • site/docs/components/plots/histogram.zh.md (1 hunks)
  • site/docs/components/plots/line.zh.md (1 hunks)
  • site/docs/components/plots/liquid.zh.md (1 hunks)
  • site/docs/components/plots/pie.zh.md (1 hunks)
  • site/docs/components/plots/radar.zh.md (1 hunks)
  • site/docs/components/plots/radial-bar.zh.md (1 hunks)
  • site/docs/components/plots/rose.zh.md (1 hunks)
  • site/docs/components/plots/sankey.zh.md (1 hunks)
  • site/docs/components/plots/scatter.zh.md (1 hunks)
  • site/docs/components/plots/stock.zh.md (1 hunks)
  • site/docs/components/plots/sunburst.zh.md (1 hunks)
  • site/docs/components/plots/treemap.zh.md (1 hunks)
  • site/docs/components/plots/venn.zh.md (1 hunks)
  • site/docs/components/plots/violin.zh.md (1 hunks)
  • site/docs/components/plots/waterfall.zh.md (1 hunks)
  • site/docs/components/plots/word-cloud.zh.md (1 hunks)
  • site/docs/options/plots/animate/overview.en.md (0 hunks)
  • site/docs/options/plots/interaction/brushHighlight.zh.md (1 hunks)
  • site/docs/options/plots/scale/ordinal.zh.md (1 hunks)
  • site/docs/options/plots/slider.zh.md (1 hunks)
💤 Files with no reviewable changes (1)
  • site/docs/options/plots/animate/overview.en.md
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: deploy
  • GitHub Check: test (latest)
  • GitHub Check: test (latest)
🔇 Additional comments (3)
site/docs/options/plots/interaction/brushHighlight.zh.md (2)

112-141: 无明显问题,可留作示例。


146-175: 同上。

site/docs/options/plots/scale/ordinal.zh.md (1)

233-262: 示例代码逻辑正确,未发现阻碍阅读的问题。

Comment thread site/docs/components/plots/funnel.zh.md Outdated
Comment thread site/docs/components/plots/column.zh.md Outdated
Comment thread site/docs/components/plots/histogram.zh.md Outdated
Comment thread site/docs/components/plots/radial-bar.zh.md Outdated
Comment thread site/docs/components/plots/waterfall.zh.md Outdated
Comment thread site/docs/components/plots/bidirectional-bar.zh.md Outdated
Comment thread site/docs/components/plots/treemap.zh.md Outdated
Comment thread site/docs/components/plots/liquid.zh.md Outdated
Comment thread site/docs/components/plots/rose.zh.md Outdated
Comment thread site/docs/components/plots/dual-axes.zh.md Outdated
@lxfu1 lxfu1 merged commit d73379f into v2 Jun 30, 2025
9 checks passed
@lxfu1 lxfu1 deleted the docs/common branch June 30, 2025 06:46
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.

1 participant