Skip to content

docs: add bullet component documentation#3004

Merged
lxfu1 merged 1 commit into
v2from
docs/bullet-component
Jun 27, 2025
Merged

docs: add bullet component documentation#3004
lxfu1 merged 1 commit into
v2from
docs/bullet-component

Conversation

@lxfu1
Copy link
Copy Markdown
Member

@lxfu1 lxfu1 commented Jun 27, 2025

Summary by CodeRabbit

  • 新功能

    • Bullet 图表现在支持通过 transpose 布尔值切换坐标方向,替代原有的 layout 配置。
    • 支持为目标元素(target)直接设置样式,例如描边颜色。
  • 修复与优化

    • 默认图层顺序调整,Bullet 图表各元素的层级更加合理。
    • 图例 marker 形状逻辑优化,更准确区分 targets。
  • 文档

    • Bullet 图表文档全面重写,新增详细配置项说明、丰富的使用示例、交互和方法说明,提升可读性和易用性。
    • 示例代码同步更新,展示新配置用法。
  • 类型变更

    • 移除 BulletOptions 类型中的 layout 属性,推荐使用 transpose 控制布局方向。

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 27, 2025

📝 Walkthrough

Walkthrough

本次变更主要对子弹图(Bullet Plot)相关的核心实现、类型定义、默认配置、示例与文档进行了重构和完善。包括参数访问方式的统一、布局属性的调整、图层顺序的明确、类型定义的精简、示例配置方式的更新,以及文档的全面扩充和结构化。

Changes

文件/分组 变更简述
packages/plots/src/core/plots/bullet/adaptor.ts 统一参数解构方式,移除 layout 属性,采用 transpose 控制布局,调整 options 赋值逻辑,优化嵌套属性设置。
packages/plots/src/core/plots/bullet/index.ts legend marker 判断逻辑由 'target' 改为 'targets',interval 图层增加 zIndex 明确分层顺序。
packages/plots/src/core/plots/bullet/type.ts BulletOptions 类型移除 layout 属性。
site/docs/components/plots/bullet.zh.md 文档重写,增加详细介绍、丰富示例、参数表、色彩与形状配置说明、事件与方法等完整结构。
site/examples/statistics/bullet/demo/bullet-group.js 配置中移除 color 对 targets 的设置,新增 target 属性以 style 方式直接设置目标色彩。
site/examples/statistics/bullet/demo/bullet-vertical.js 配置项由 layout: 'vertical' 改为 transpose: false,布局控制方式调整。

Sequence Diagram(s)

sequenceDiagram
    participant 用户
    participant BulletPlot
    participant Options
    用户->>BulletPlot: 初始化(传入 options)
    BulletPlot->>Options: 解构参数(统一提取 options)
    BulletPlot->>Options: 判断 transpose 控制布局
    BulletPlot->>Options: 设置 children、legend、zIndex 等属性
    BulletPlot-->>用户: 渲染子弹图
Loading

Poem

小兔挥笔绘子弹,
参差图层明分辨。
纵横布局一键转,
参数解构更方便。
文档示例新又全,
跳跃创新乐无边!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

site/examples/statistics/bullet/demo/bullet-group.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/site".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "site/.eslintrc.js » /node_modules/.pnpm/@umijs+fabric@2.14.1/node_modules/@umijs/fabric/dist/eslint.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

site/examples/statistics/bullet/demo/bullet-vertical.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/site".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "site/.eslintrc.js » /node_modules/.pnpm/@umijs+fabric@2.14.1/node_modules/@umijs/fabric/dist/eslint.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch docs/bullet-component

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 23a9123 and 0a47acd.

📒 Files selected for processing (6)
  • packages/plots/src/core/plots/bullet/adaptor.ts (6 hunks)
  • packages/plots/src/core/plots/bullet/index.ts (2 hunks)
  • packages/plots/src/core/plots/bullet/type.ts (0 hunks)
  • site/docs/components/plots/bullet.zh.md (2 hunks)
  • site/examples/statistics/bullet/demo/bullet-group.js (1 hunks)
  • site/examples/statistics/bullet/demo/bullet-vertical.js (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/plots/src/core/plots/bullet/type.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/plots/src/core/plots/bullet/adaptor.ts (2)
packages/plots/src/core/utils/index.ts (3)
  • map (20-20)
  • set (12-12)
  • mergeWithArrayCoverage (37-37)
packages/plots/src/core/utils/merge-with-array-coverage.ts (1)
  • mergeWithArrayCoverage (9-11)
🪛 markdownlint-cli2 (0.17.2)
site/docs/components/plots/bullet.zh.md

94-94: Table column count
Expected: 5; Actual: 4; Too few cells, row will be missing data

(MD056, table-column-count)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: deploy
🔇 Additional comments (8)
site/examples/statistics/bullet/demo/bullet-group.js (1)

35-37: API 改进看起来不错!

color.targets 映射改为直接在 target.style 设置样式属性,这种方式更加直观和一致。新的配置方式让用户能够直接控制目标元素的样式属性。

site/examples/statistics/bullet/demo/bullet-vertical.js (1)

15-15: 布局配置简化得很好!

使用 transpose: false 替代 layout: 'vertical' 更加直观,明确表达了坐标转置的概念。这种简化让 API 更容易理解和使用。

packages/plots/src/core/plots/bullet/index.ts (2)

28-28: 图例标记器逻辑更新合理!

将条件从 'target' 改为 'targets' 与数据字段命名保持一致,提高了 API 的连贯性。


39-39: 明确的图层顺序控制!

为间隔元素添加明确的 zIndex 属性(-2 和 -1)是个好的实践,确保了渲染顺序的可预测性和一致性。

Also applies to: 44-44

packages/plots/src/core/plots/bullet/adaptor.ts (3)

104-104: 代码重构提升了可读性!

在函数开始时提取 options 并一致使用是个很好的实践,让代码更加清晰和易于维护。

Also applies to: 113-113


171-173: 布局逻辑简化得当!

使用 transpose 布尔标志替代 layout 属性简化了 API,逻辑更加直观。默认值 true 的设置也很合理。


186-189: 配置适配器重构良好!

统一的选项提取和使用模式提高了代码的一致性和可维护性。

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

11-105: 文档内容丰富全面!

新增的子弹图文档非常详尽,包含了清晰的组件介绍、多个实用示例和完整的配置项说明。这将大大帮助用户理解和使用该组件。

Comment thread site/docs/components/plots/bullet.zh.md
@lxfu1 lxfu1 merged commit d9b49fe into v2 Jun 27, 2025
9 checks passed
@lxfu1 lxfu1 deleted the docs/bullet-component branch June 27, 2025 10:16
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