Skip to content

Conversation

SakonSun
Copy link
Contributor

Checklist
  • [x ] npm test passes
  • [x ] tests and/or benchmarks are included
  • [x ] commit message follows commit guidelines
Description of change

在自动隐藏策略下,当找不到均分点时,保留最大步长处的x轴label
Copy link

Summary of Changes

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

此拉取请求旨在优化 F2 图表库中轴标签的自动隐藏策略。通过引入一个阈值,当轴标签无法均匀分布时,除了默认显示首尾标签外,如果数据范围足够大且不会导致标签重叠,系统将智能地显示一个中间标签,从而在保持图表清晰度的同时,提供更丰富的数据概览。

Highlights

  • 新增常量: 引入了一个名为 "SHOW_MIDDLE_LABEL_THRESHOLD" 的新常量,用于控制中间标签的显示阈值。
  • 优化轴标签自动隐藏策略: 当无法找到最佳步长时,除了保留首尾标签外,如果数据范围较大且没有重叠,现在会额外显示一个中间标签,以提供更好的数据上下文。
  • 新增测试用例: 添加了一个新的测试用例 ("不均匀隐藏"),以验证更新后的轴标签自动隐藏逻辑在特定数据集下的行为。
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

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 调整了坐标轴标签的 autoHide 策略。当找不到最佳步长时,除了显示第一个和最后一个标签外,如果标签总数较多,还会尝试显示中间的标签。这个改动可以改善在有大量数据点时轴标签的可读性。

代码实现上,在 withAxis.tsx 中引入了 SHOW_MIDDLE_LABEL_THRESHOLD 常量来决定何时触发显示中间标签的逻辑,并在找不到最佳步长时,有条件地显示中间位置的标签。同时,在 labelAuto.test.tsx 中增加了一个新的测试用例来覆盖这个场景。

我对 withAxis.tsx 中的逻辑有一个建议,主要是关于重叠检测的准确性,详见具体评论。

@tangying1027 tangying1027 merged commit d60aa3f into antvis:master Sep 22, 2025
2 of 4 checks passed
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.

2 participants