Skip to content

Conversation

@goldenfishzhenianqi
Copy link
Contributor

@goldenfishzhenianqi goldenfishzhenianqi commented Sep 4, 2025

此PR新增一个堆叠分组柱线图的参考示例
zhuxiantu

Summary by CodeRabbit

  • 新功能
    • 新增双轴示例「分组堆叠柱 + 折线」:支持按组堆叠柱与右轴折线展示,含自定义图例标记与完善的提示信息,便于对比趋势与分布。
  • 文档
    • 更新示例库元数据:为新示例添加中英文标题与截图,现可在示例列表中浏览与预览。

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 4, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

📝 Walkthrough

Walkthrough

新增一个 React 示例 grouped-stacked-column-line.js,使用 Ant Design Plots 的 DualAxes 渲染左侧分组堆叠柱与右侧折线的双轴图;并在 meta.json 中登记该示例的元数据与截图信息。

Changes

Cohort / File(s) Summary
DualAxes 示例实现
site/examples/statistics/dual-axes/demo/grouped-stacked-column-line.js
新增 React 示例组件 DemoDualAxes:定义两份数据集(柱用 value,折线用 count),配置 DualAxes 的 xField、双轴 children(左:分组堆叠 interval;右:折线),自定义图例 itemMarker(线为虚线、柱为方块),并通过 React 18 createRoot 挂载至 #container
示例元数据
site/examples/statistics/dual-axes/demo/meta.json
新增该示例的元数据条目(中英标题与截图 URL),置于 grouped-column-line.js 之后;未改动其他条目。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User as User
    participant Browser as Browser
    participant React as React App
    participant DualAxes as DualAxes Chart
    participant Bars as Interval (stacked & grouped)
    participant Line as Line (right axis)

    User->>Browser: 打开示例页面
    Browser->>React: 初始化应用
    React->>DualAxes: 渲染 DualAxes(config)
    Note right of DualAxes: 自定义图例标记(线=虚线,柱=方块)<br/>xField=time;左轴=value;右轴=count
    DualAxes->>Bars: 渲染分组堆叠柱(groupBy: [x, series])
    DualAxes->>Line: 渲染折线(count, lineWidth=2)
    Bars-->>DualAxes: 完成
    Line-->>DualAxes: 完成
    DualAxes-->>Browser: 绘制到画布
    Browser-->>User: 显示双轴图
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

我把两根轴线轻轻排,(=^・^=)
左堆右线并肩开,
方块柱子成群来,
细线数值把月载,
一耳微动图例改,
小兔点头:示例新,又整齐又可爱。

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @goldenfishzhenianqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过添加一个新的分组堆叠柱线图示例来扩展现有图表库的文档和示例集。这为用户提供了更多可视化选项的参考,并展示了如何结合使用堆叠柱状图和折线图来呈现复杂的数据关系。

Highlights

  • 新增图表示例: 此PR新增了一个分组堆叠柱线图的参考示例,丰富了图表库的展示能力。
  • 文件变更: 新增了 grouped-stacked-column-line.js 文件,其中包含了使用 @ant-design/plotsDualAxes 组件实现的图表配置和数据。同时更新了 meta.json 文件,注册了新的图表示例及其元数据。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

此 PR 新增了一个分组堆叠柱线图的示例,实现清晰。我主要提出了一些关于示例数据和代码简洁性的建议,以提高示例的清晰度和代码质量。请查看具体评论。

Comment on lines +13 to +17
{ time: '2025-03', value: 350, group: 'uv', type: 'b' },
{ time: '2025-04', value: 900, group: 'uv', type: 'b' },
{ time: '2025-05', value: 300, group: 'uv', type: 'b' },
{ time: '2025-06', value: 450, group: 'uv', type: 'b' },
{ time: '2025-07', value: 470, group: 'uv', type: 'b' },

Choose a reason for hiding this comment

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

high

uvBillDatagroup: 'uv' 的两组数据(type: 'a'type: 'b')是完全相同的。这会导致堆叠效果不明显,因为两个系列的值一样。为了更好地展示堆叠柱状图的效果,建议修改其中一组数据的值,使其有所区别。

Suggested change
{ time: '2025-03', value: 350, group: 'uv', type: 'b' },
{ time: '2025-04', value: 900, group: 'uv', type: 'b' },
{ time: '2025-05', value: 300, group: 'uv', type: 'b' },
{ time: '2025-06', value: 450, group: 'uv', type: 'b' },
{ time: '2025-07', value: 470, group: 'uv', type: 'b' },
{ time: '2025-03', value: 400, group: 'uv', type: 'b' },
{ time: '2025-04', value: 500, group: 'uv', type: 'b' },
{ time: '2025-05', value: 600, group: 'uv', type: 'b' },
{ time: '2025-06', value: 350, group: 'uv', type: 'b' },
{ time: '2025-07', value: 570, group: 'uv', type: 'b' },

@dosubot dosubot bot added the plots 统计图表G2 label Sep 4, 2025
Copy link

@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

🧹 Nitpick comments (1)
site/examples/statistics/dual-axes/demo/meta.json (1)

181-181: 截图使用 AVIF,建议与站内格式保持一致并兼容回退

大多数现有示例使用 WebP 或 original;为提升兼容性与一致性,建议改为 WebP(或提供回退)。

可以直接替换为同路径的 WebP 版本(若资源已同步):

-      "screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*hhUWS6yU84YAAAAAQWAAAAgAemJ7AQ/fmt.avif"
+      "screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*hhUWS6yU84YAAAAAQWAAAAgAemJ7AQ/fmt.webp"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5f581e5 and 9a40bbb.

📒 Files selected for processing (2)
  • site/examples/statistics/dual-axes/demo/grouped-stacked-column-line.js (1 hunks)
  • site/examples/statistics/dual-axes/demo/meta.json (1 hunks)
🔇 Additional comments (5)
site/examples/statistics/dual-axes/demo/meta.json (1)

176-181: 新增 demo 元数据整体 OK

文件名、标题与实际示例一致,插入位置也合理。

site/examples/statistics/dual-axes/demo/grouped-stacked-column-line.js (4)

70-75: 右轴配置与线型样式清晰

右侧 y 轴的位置与线宽设置合理,能直观区分度量。


6-24: 数据示例覆盖了分组与堆叠维度

group+type 组合清晰,时间序列从 2025-03 至 2025-07 连贯,便于读者理解。

Also applies to: 26-32


48-68: 保持 children 配置并确认 stack.groupBy 使用通道名
site/examples/statistics/dual-axes/demo 目录下所有 DualAxes 示例均已统一采用 children 配置,无 geometryOptions 用法;stack.groupBy 传入通道名 'series' 符合 v2 API 要求。


34-46: 保持 'dash' 标记,无需修改 legend.itemMarker 支持 'dash',当前主题配置中 shapes.line 包含 'dash',为合法内置 marker 类型。 (g2-v3.antv.vision)

Likely an incorrect or invalid review comment.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 9, 2025
@lxfu1 lxfu1 merged commit 0c062a4 into ant-design:v2 Sep 9, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer plots 统计图表G2 size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants