Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(line): fix error when color field is cat #1625

Merged
merged 1 commit into from
Sep 24, 2020
Merged

Conversation

hustcc
Copy link
Member

@hustcc hustcc commented Sep 24, 2020

No description provided.

@hustcc hustcc requested a review from liuzhenying September 24, 2020 07:03
@auto-add-label auto-add-label bot added the Bug Something isn't working label Sep 24, 2020
Copy link
Member

@liuzhenying liuzhenying left a comment

Choose a reason for hiding this comment

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

如上

@@ -108,7 +108,8 @@ export function geometry<O extends GeometryOptions>(params: Params<O>): Params<O
if (isString(color)) {
colorField ? geometry.color(colorField, color) : geometry.color(color);
} else if (isFunction(color)) {
const mappingFields = getMappingField(options, 'color');
// 对于单折线图的特殊处理,如果 x 轴是分类 scale,会导致映射错误
const mappingFields = getMappingField(options, 'color').filter((f: string) => f !== xField);
geometry.color(mappingFields.join('*'), getMappingFunction(mappingFields, color));
Copy link
Member

Choose a reason for hiding this comment

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

这块儿感觉会留下隐患,即 geo.color(size/shape),若触发了 mappingField 里含有 cat 类字段,会在视觉通道映射出来,而不是只作为参数传入。不过我过了遍我们现在的图表,除了这次修的多折线图,暂时没发现其他触发这一 问题的 case,所以先过了~

Copy link
Member Author

@hustcc hustcc Sep 24, 2020

Choose a reason for hiding this comment

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

是的,因为目前只有 line 会出现问题,而 line 目前只有 x y colorField,如果后面有 shapeField,可能就崩了。但是目前 shapeField 只有 scatter 会用到,scatter 的 point 又不会有 line 的问题。

@hustcc hustcc merged commit 157f9ce into master Sep 24, 2020
@hustcc hustcc deleted the fix-line-color-cat-field branch September 24, 2020 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working PR: merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants