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

Interval shape 增加 minHeight 最小高度的配置 #5686

Closed
1 task done
hustcc opened this issue Oct 25, 2023 · 12 comments
Closed
1 task done

Interval shape 增加 minHeight 最小高度的配置 #5686

hustcc opened this issue Oct 25, 2023 · 12 comments
Assignees

Comments

@hustcc
Copy link
Member

hustcc commented Oct 25, 2023

AntV Open Source Contribution Plan(可选)

  • 我同意将这个 Issue 参与 OSCP 计划

Issue 难度

中等难度

任务介绍

当柱形图的数据为 0 的时候,这个时候无法显示图形,也无法显示 tooltip。参考问题:ant-design/ant-design-charts#2148

实现之后的使用方式:

chart
  .interval()
  .data(data)
  .encode("x", "genre")
  .encode("y", "sold")
  .style('minHeight', 10) // 设置最小高度,单位为像素

具体修改在文件 src/shape/interval/color.ts 中。

详细介绍

No response

参考说明

No response

@iamzone
Copy link
Contributor

iamzone commented Nov 1, 2023

【iamzone 认领】

@iamzone
Copy link
Contributor

iamzone commented Nov 1, 2023

  1. 添加 minHeight maxHeight
  2. 在计算高度为 0 时, 使用 minHeight

@Runtus
Copy link
Contributor

Runtus commented Nov 1, 2023

【Runtus 认领】

@pearmini
Copy link
Member

pearmini commented Nov 2, 2023

@Runtus 你和 @iamzone 都认领和 PR 了,但是 @iamzone 认领和提 PR 的时间都会早一点,所以这个任务按照 @iamzone 的 PR 来,如何?

@Runtus
Copy link
Contributor

Runtus commented Nov 2, 2023

@pearmini 我这是没问题,昨天我是看那位提的PR有问题,我才重新提的,您可以看下,那位的minHeight展示出来的柱形图是倒着的

@BENcorry
Copy link
Contributor

BENcorry commented Nov 2, 2023

第二点的逻辑是不是有点问题,应该是finalHeight = Math.max(minHeight, Math.min(maxHeight, height)) 吧,而不是为0的场景才使用minHeight

@iamzone
Copy link
Contributor

iamzone commented Nov 2, 2023

第二点的逻辑是不是有点问题,应该是finalHeight = Math.max(minHeight, Math.min(maxHeight, height)) 吧,而不是为0的场景才使用minHeight

image
按照你的说法,应该就不需要 tpShape 控制,我也是不太清楚 tpShape 的作用,所以没有贸然修改太多代码

@pearmini
Copy link
Member

pearmini commented Nov 2, 2023

@Runtus 嗯嗯,理解了,非常贴心,你的 PR 也很规范。不过,如果这个 #5715 PR 里面代码有问题的话,建议直接去 CR。@BENcorry 同样可以去 #5715 提出认为有问题的地方,然后大家一起讨论一下!

@Runtus
Copy link
Contributor

Runtus commented Nov 2, 2023

@pearmini 好的🙏

@pearmini
Copy link
Member

pearmini commented Nov 2, 2023

@Runtus 感谢理解,后面马上还会有一些任务发布,期待你的贡献!👍

@pearmini pearmini assigned Runtus and iamzone and unassigned Runtus Nov 3, 2023
@pearmini
Copy link
Member

pearmini commented Nov 7, 2023

closed by: #5715

@pearmini
Copy link
Member

@iamzone @Runtus

感谢对 G2 对贡献!欢迎加入下面的群,进一步贡献和了解更多:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

5 participants