antvis/G2

timeCat scale 在 attribute 回调中,返回数值而不是时间字符串 #3367

visiky posted onGitHub

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

https://riddle.alibaba-inc.com/riddles/f8938015

Steps to reproduce

https://riddle.alibaba-inc.com/riddles/f8938015

image image
Environment Info
g2 4.1.13
System -
Browser -

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


  • 如果设置 scale 为 time 和 cat 是没有问题的,所有回调中返回的是字符串,当前场景没有问题。
  • 当不设置 scale 的时候,默认是 timeCat,在 attribute(color、shape...)回调中返回的时间戳,因为这里回调中的数据是经过比例尺处理的,当前场景下会有问题。在 style 回调返回的是字符串,因为这里使用的是 originData。

这个问题应该是底层 scale v.0.3.x 的 bug,在处理 timeCat 的 values 的时候,直接把原来的 values 全部转化成了时间戳。

<img width="468" alt="截屏2021-05-13 下午2 13 24" src="https://user-images.githubusercontent.com/49330279/118085698-6357f400-b3f5-11eb-9687-f86275147cc0.png">

posted by pearmini almost 4 years ago

Fund this Issue

$0.00
Funded

Pull requests