fix(column): 修复柱图 color 回调导致 slider 显示异常#3876
Open
xiecg wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to handle color callbacks for interval geometries by integrating them into the style mapping when a specific color field is absent. It refactors the mapping logic into a reusable getMappingDatum function and adds a unit test to verify the behavior. A performance improvement was suggested to avoid recreating a mapping function inside the style callback for every data point, recommending the direct use of getMappingDatum instead.
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.
PR includes
Description
当柱图未配置
seriesField,但color使用函数回调时,原逻辑会将回调绑定到xField的 color 通道上,导致 G2 将其作为分组字段处理,从而影响 slider 场景下的裁剪显示。本 PR 在无
colorField的interval图形中,将函数型color的结果映射到style.fill,避免生成额外的 color 分组 scale,同时保留自定义颜色效果。Changes
color在无拆分字段的interval图形中的映射方式color callback + slider的回归用例Screenshot
Before

After

Test
npm run lib:cjs