Skip to content
New issue

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

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

Already on GitHub? # to your account

目前 groupArrary 是通过 category 去分组的,分组完成之后应该去除掉 yScale.field 字段不存在的分组。 #716

Closed
1 task done
benvirus opened this issue Nov 26, 2019 · 0 comments · Fixed by #727

Comments

@benvirus
Copy link
Contributor

benvirus commented Nov 26, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://codepen.io/benvirus/pen/jOEOyEO

Steps to reproduce

如上面的连接所示,由于 data 中 cat 有四个值,其中两个通过 interval 显示,另外两个通过 line 显示。但是在 interval 中,rect 的宽度还是会按照 4 个值去计算。所以会有显示问题。

What is expected?

期待不同的 gemo 只把 position 中 yScale.field 至少存在一个值的 cat 参与计算,如果某个 cat 在 groupArray 中的所有 subArr 中都没有值,就过滤掉。
image

What is actually happening?

目前没有过滤掉和 yScale.field 不想关的 category ,造成显示问题。
image

Environment Info
f2 3.4.3
System macOS
Browser Chrome

业务场景:要画柱形和和折线图的混合图。但是折线图是另外一个指标。
解决方案:

// src/geom/base.js:199
const yScale = this.getYScale();
const groupedArray = this._groupData(data).filter(group =>
  group.some(item => typeof item[yScale.field] !== 'undefined')
);
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant