antvis/G2

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

hustcc posted onGitHub

AntV Open Source Contribution Plan(可选)

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

Issue 难度

中等难度

任务介绍

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

实现之后的使用方式:

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

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

详细介绍

No response

参考说明

No response


【iamzone 认领】

posted by iamzone over 1 year ago
  1. 添加 minHeight maxHeight
  2. 在计算高度为 0 时, 使用 minHeight
posted by iamzone over 1 year ago

【Runtus 认领】

posted by Runtus over 1 year ago

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

posted by pearmini over 1 year ago

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

posted by Runtus over 1 year ago

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

posted by BENcorry over 1 year ago

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

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

posted by iamzone over 1 year ago

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

posted by pearmini over 1 year ago

@pearmini 好的🙏

posted by Runtus over 1 year ago

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

posted by pearmini over 1 year ago
posted by pearmini over 1 year ago

@iamzone @Runtus

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

<img src="https://github.com/antvis/G2/assets/49330279/fcee44fa-bc79-4f13-b1eb-12fa94164606" width=240 />

posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests