Skip to content

Conversation

@moayuisuda
Copy link
Collaborator

Checklist
  • npm test passes
Description of change

支持层叠图
image
image

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @moayuisuda, 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!

This pull request significantly extends G2's capabilities by introducing a new hierarchy mark type, designed for rendering complex hierarchical data structures. It features a unique layout algorithm that visually emphasizes parent-child relationships and comes with a built-in DrillDown interaction, allowing users to intuitively navigate through different levels of the hierarchy. This addition provides a powerful tool for visualizing and exploring tree-like datasets.

Highlights

  • New Hierarchy Mark: Introduced a hierarchy composite mark for visualizing hierarchical data, providing a structured way to display parent-child relationships.
  • Custom Layout Algorithm: Implemented a hierarchyLayout function that positions child nodes relative to their parents, supporting options like sort and fillParent for flexible rendering.
  • Dedicated DrillDown Interaction: Added a DrillDown interaction specifically for hierarchy charts, enabling interactive exploration of data levels with breadcrumb navigation.
  • Core Integration: The new hierarchy mark and DrillDown interaction are integrated into the G2 core library, making them readily available for chart creation.
  • Comprehensive Test Coverage: Included new test cases (flareHierarchyDefault, flareHierarchyDefaultSort) to ensure the correct functionality and behavior of the hierarchy mark.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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
Contributor

@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 引入了新的 hierarchy 标记类型和 DrillDown 交互,用于支持层级结构可视化(如层叠图)。这是一个很棒的功能增强。代码整体结构清晰,但我在 hierarchy.tsdrillDown.ts 中发现了一些需要注意的问题,主要涉及数据处理的正确性、性能和 API 的一致性。请查看我的具体评论。

@hustcc
Copy link
Member

hustcc commented Nov 17, 2025

这个叫 hierarchy mark 嘛?会不会太大了,hierarchy 代表着层级数据,他的可视化呈现肯定不至于火焰图,包括树图、矩阵树图都是属于 hierarchy 数据结构的。

@moayuisuda
Copy link
Collaborator Author

那用 partition 吧,Partition

@hustcc
Copy link
Member

hustcc commented Nov 18, 2025

那用 partition 吧,Partition

是这个图吗?https://g2.antv.antgroup.com/examples/general/interval/#bar-marimekko

@hustcc
Copy link
Member

hustcc commented Nov 18, 2025

不如直接叫 flame https://github.com/spiermar/d3-flame-graph?tab=readme-ov-file 类似于词云图,旭日图这些。

@moayuisuda
Copy link
Collaborator Author

想的是把这个 mark 做宽泛一点,用来承载嵌套数据的场景,不同 encode、coordinate 配置下可以转换为 层叠图、火焰图、旭日图 这些,旭日图这种之前写死 encode 的定制图表就不再透出了

@coveralls
Copy link

coveralls commented Nov 18, 2025

Pull Request Test Coverage Report for Build 19496544097

Details

  • 97 of 179 (54.19%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 79.976%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/mark/partition.ts 73 76 96.05%
src/interaction/drillDown.ts 24 103 23.3%
Totals Coverage Status
Change from base Build 19352494524: -0.5%
Covered Lines: 10413
Relevant Lines: 12492

💛 - Coveralls

@moayuisuda moayuisuda changed the title feat: add mark hierarchy feat: add mark partition Nov 18, 2025
@@ -0,0 +1,265 @@
import type { TextStyleProps, DisplayObject } from '@antv/g';
Copy link
Member

Choose a reason for hiding this comment

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

这里的 drillDown 能和 treemapDrillDown 合并吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

下个pr合并吧,试了下改动有点大

};
showBreadCrumb?: boolean;
maxDepth?: number;
single?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

这里的single和background我看交互里都没用到?

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.

5 participants