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

refactor: unify scale flow and simplify code #116

Merged
merged 4 commits into from
Apr 22, 2021
Merged

Conversation

pearmini
Copy link
Member

@pearmini pearmini commented Apr 22, 2021

重构了一下代码,抽取了一些复用逻辑,主要的修改如下:

  • 梳理了所有 scale 的使用流程:初始化和更新 options 的时候,根据传入的 options 和已有的 options 更新内部状态 rescale,然后根据内部的状态去 map 和 invert。
  • 将 getOverrideDefaultOptions 变成了 getDefaultOptions,每个比例尺在 getDefaultOptions 返回完整的默认值,这样可读性更强。
  • continuous 类的比例尺
    • nice 和 getTicks 都提取到 continuous 比例尺中。
    • chooseTransform 和 chooseUnTransform 的合并。

@pearmini pearmini merged commit 4174d00 into master Apr 22, 2021
@pearmini pearmini deleted the refactor/scales branch April 22, 2021 13:54
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.

None yet

2 participants