Skip to content

fix(column): 修复柱图 color 回调导致 slider 显示异常#3876

Open
xiecg wants to merge 2 commits into
antvis:masterfrom
xiecg:fix/column-slider-color-callback
Open

fix(column): 修复柱图 color 回调导致 slider 显示异常#3876
xiecg wants to merge 2 commits into
antvis:masterfrom
xiecg:fix/column-slider-color-callback

Conversation

@xiecg

@xiecg xiecg commented Apr 27, 2026

Copy link
Copy Markdown

PR includes

Description

当柱图未配置 seriesField,但 color 使用函数回调时,原逻辑会将回调绑定到 xField 的 color 通道上,导致 G2 将其作为分组字段处理,从而影响 slider 场景下的裁剪显示。

本 PR 在无 colorFieldinterval 图形中,将函数型 color 的结果映射到 style.fill,避免生成额外的 color 分组 scale,同时保留自定义颜色效果。

Changes

  • 调整函数型 color 在无拆分字段的 interval 图形中的映射方式
  • 增加柱图 color callback + slider 的回归用例

Screenshot

Before
image

After
image

Test

  • npm run lib:cjs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread src/adaptor/geometries/base.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [BUG] color 使用函数调用时,slider 显示 bug

1 participant