fix: moasic chart's crosshair can not render rect shape - #4561
Merged
Merged
Conversation
xuefei1313
approved these changes
Apr 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes crosshair rect rendering for mosaic-like (reversed start/end) continuous data ranges by normalizing range comparisons and positioning.
Changes:
- Update
getDatumByValueto match values within a range regardless of whetherstartFieldis less than or greater thanendField. - Adjust cartesian crosshair layout logic to anchor
coordat the left edge of a continuous range band (usingMath.min(posStart, posEnd)). - Add unit tests covering reversed-field range lookup and rect crosshair layout behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/vchart/src/component/crosshair/utils/common.ts |
Makes datum lookup range-direction agnostic via min/max bounds. |
packages/vchart/src/component/crosshair/utils/cartesian.ts |
Fixes continuous range band positioning so rect crosshair spans the expected interval (incl. mosaic). |
packages/vchart/__tests__/unit/component/crosshair/crosshair-util.test.ts |
Adds unit coverage for reversed ranges and rect layout/clamping behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
xuefei1313
reviewed
Apr 16, 2026
xuefei1313
left a comment
Contributor
There was a problem hiding this comment.
自动 Review(机器人):
- 关注点:本次 PR 为修复 Mosaic 图的 crosshair 渲染(rect 形状)。
- 建议自查:
- 是否新增/更新了对应的 demo 或单测,覆盖 rect/line 等不同形状;
- crosshair 在不同主题/缩放/高清屏下的边界与对齐;
- 是否影响 tooltip / axis pointer 等相关交互;
- 请以 CI 结果为准,如 CI 全绿且本地验证通过,可考虑合入。
(本评论为自动化提示,不代替人工 Review)
xuefei1313
enabled auto-merge
April 17, 2026 08:42
20 tasks
Sort range endpoints numerically while preserving their original text. Cover both axes, inverse scales, numeric strings and rect/line layout. Constraint: Preserve endpoint text and custom label formatting Confidence: high Scope-risk: narrow Not-tested: Electron, browser visual checks and full typecheck
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough