Skip to content

fix: keep crosshair visible for explicitly bound band axes - #4642

Open
biubiukam wants to merge 1 commit into
VisActor:developfrom
biubiukam:fix/issue-4127-multiple-axis-crosshair
Open

fix: keep crosshair visible for explicitly bound band axes#4642
biubiukam wants to merge 1 commit into
VisActor:developfrom
biubiukam:fix/issue-4127-multiple-axis-crosshair

Conversation

@biubiukam

Copy link
Copy Markdown

🤔 这个分支是...

  • 新功能
  • Bug fix
  • Ts 类型更新
  • 打包优化
  • 性能优化
  • 功能增强
  • 重构
  • 依赖版本更新
  • 代码优化
  • 测试 case 更新
  • 分支合并
  • 发布
  • 网站/文档更新
  • demo 更新
  • Workflow
  • 其他 (具体是什么,请补充?)

🔗 相关 issue 链接

Fix #4127

Issue #4127

🔗 相关的 PR 链接

N/A

🐞 Bugserver 用例 id

N/A

💡 问题的背景&解决方案

在 common chart 中同时配置 bottom 和 top 两个 band 轴,并通过:

crosshair: {
  xField: {
    visible: true,
    bindingAxesIndex: [1, 2]
  }
}

显式绑定多个离散轴时,crosshair 无法显示。

问题原因是 _setAllAxisValues 原先只要检测到同方向存在多个离散轴,就会将 crosshair 的 enable 设置为 false,没有区分用户是否已经通过 bindingAxesIndex 明确选择了轴。

本次修改:

  1. 仅在未显式绑定轴时保留多个离散轴的歧义保护。
  2. 当存在有效的 bindingAxesIndex 时,允许 crosshair 同时处理多个明确绑定的 band 轴。
  3. 增加回归测试,验证显式绑定的轴索引为 [1, 2],且未绑定的同向轴不会被处理。

未修改公开 API 和 TypeScript 类型定义;未显式绑定多个离散轴时仍保持原有行为。

📝 Changelog

Language Changelog
🇺🇸 English Keep crosshair visible when multiple band axes are explicitly selected with bindingAxesIndex.
🇨🇳 Chinese 修复通过 bindingAxesIndex 显式绑定多个 band 轴时 crosshair 消失的问题。

☑️ 自测

⚠️ 在提交 PR 之前,请检查一下内容. ⚠️

  • 文档提供了,或者更新,或者不需要
  • Demo 提供了,或者更新,或者不需要
  • Ts 类型定义提供了,或者更新,或者不需要
  • Changelog 提供了,或者不需要

✅ 验证结果

  • pnpm --filter @visactor/vchart exec jest __tests__/unit/core/vchart-event.test.ts --runInBand
    • 1 个测试套件通过,19 个测试通过
  • pnpm --filter @visactor/vchart run compile
    • TypeScript 编译通过
  • node common/scripts/install-run-rush.js run -p @visactor/vchart -s build:cjs
    • CJS 构建通过
  • node common/scripts/install-run-rush.js test -t @visactor/vchart
    • 76 个测试套件通过,398 个测试通过
  • 变更文件格式、Prettier、ESLint 和 git diff --check 均通过

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] crosshair disappear when set both top and bottom axis in common chart

1 participant