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: update legend component inferring strategies #4906

Merged
merged 2 commits into from
Apr 23, 2023
Merged

Conversation

Aarebecca
Copy link
Contributor

@Aarebecca Aarebecca commented Apr 23, 2023

通过比例尺推断组件添加了额外的规则:

  1. 如果比例尺全为常量比例尺,则不推断图例
  2. 如果组件为连续图例,其颜色比例尺必须指定domain

fixed #4904

src/runtime/component.ts Outdated Show resolved Hide resolved
@pearmini
Copy link
Member

如果组件为连续图例,其颜色比例尺必须指定domain

为啥需要这个限制?

@Aarebecca
Copy link
Contributor Author

如果组件为连续图例,其颜色比例尺必须指定domain

为啥需要这个限制?

没有颜色的话或者单一颜色,绘制连续比例尺应该没有意义

src/runtime/component.ts Outdated Show resolved Hide resolved
@Aarebecca
Copy link
Contributor Author

图例组件推断关系

例子:
当前比例尺组合为: color 通道为离散比例尺,shape 通道为 常数比例尺
则会匹配上第规则 27,因此可以使用分类图例

如果比例尺组合为:shape 通道为离散比例尺,size 通道为 常数比例尺
则没有可匹配的规则,因此当前比例尺组合不会推断出图例

legendCategory

  1. color-discrete opacity-discrete shape-discrete size-constant
  2. color-discrete opacity-constant shape-discrete size-constant
  3. color-discrete opacity-discrete shape-constant size-constant
  4. color-discrete opacity-constant shape-constant size-constant
  5. color-constant opacity-discrete shape-discrete size-constant
  6. color-constant opacity-constant shape-discrete size-constant
  7. color-constant opacity-discrete shape-constant size-constant
  8. color-discrete shape-discrete size-constant
  9. color-discrete opacity-discrete shape-discrete
  10. color-discrete opacity-discrete size-constant
  11. color-discrete opacity-constant shape-discrete
  12. color-discrete opacity-constant size-constant
  13. color-discrete shape-constant size-constant
  14. color-discrete opacity-discrete shape-constant
  15. color-discrete opacity-constant shape-constant
  16. color-constant shape-discrete size-constant
  17. color-constant opacity-discrete shape-discrete
  18. color-constant opacity-discrete size-constant
  19. color-constant opacity-constant shape-discrete
  20. color-constant opacity-constant size-constant
  21. color-constant shape-constant size-constant
  22. color-constant opacity-discrete shape-constant
  23. color-discrete shape-discrete
  24. color-discrete size-constant
  25. color-discrete opacity-discrete
  26. color-discrete opacity-constant
  27. color-discrete shape-constant
  28. color-constant shape-discrete
  29. color-constant size-constant
  30. color-constant opacity-discrete
  31. color-constant opacity-constant
  32. color-constant shape-constant
  33. color-discrete
  34. color-constant

legendContinuousSize

  1. color-continuous opacity-continuous size-continuous
  2. color-constant opacity-continuous size-continuous
  3. color-continuous size-continuous
  4. color-constant size-continuous

legendContinuousBlockSize

  1. color-distribution opacity-distribution size-distribution
  2. color-distribution size-distribution

legendContinuousBlock

  1. color-distribution opacity-continuous
  2. color-distribution

legendContinuous

  1. color-continuous opacity-continuous
  2. color-continuous

@Aarebecca Aarebecca changed the title fix: add extra rules to avoid unexcept component inferring fix: update legend component inferring strategies Apr 23, 2023
@hustcc
Copy link
Member

hustcc commented Apr 23, 2023

图例组件推断关系

这个我们周一一起筛查一下,究竟哪些是需要显示图例的。比如:单测截图中的但颜色的 size 图例,就感觉默认不太合理,虽然用户通过 api 都可以调整,但是最好还是默认就相对来说是好用好看的。

@hustcc hustcc merged commit 1816339 into v5 Apr 23, 2023
3 checks passed
@hustcc hustcc deleted the fix/fix-component-infer branch April 23, 2023 09:49
hustcc pushed a commit that referenced this pull request May 16, 2023
* fix: add extra rules to avoid unexcept component inferring

* refactor: update legend inferring config
hustcc pushed a commit that referenced this pull request May 16, 2023
* fix: add extra rules to avoid unexcept component inferring

* refactor: update legend inferring config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【v5】散点图 size 绑定数据时,color 设置固定颜色无法作图
3 participants