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

多View联动下的日期为中文时,"选框"功能时效 #4385

Closed
zhaoqi5757 opened this issue Dec 1, 2022 · 2 comments
Closed

多View联动下的日期为中文时,"选框"功能时效 #4385

zhaoqi5757 opened this issue Dec 1, 2022 · 2 comments

Comments

@zhaoqi5757
Copy link

#antv上的图例地址
https://antv-g2.gitee.io/zh/examples/interaction/brush#brush-ds-state

#问题描述
antv G2中的框选日期格式只支持 英文日期 ,不支持中文日期格式(例如:"2022-01-01")。当数据传入中文日期格式操作选框时,其它几个View中的数据无显示。

#测试环境描述
1、不使用代理,在 antv下“中国镜像”环境下测试过不支持中文
2、在 vue项目中测试过,并在项目中main.js中设置中文日期也不行(moment.locale("zh-CN"); )

#图片描述
全部为英文日期格式时,选框功能 正常
image
第1条数据为英文日期格式,后面的为中文日期格式,选框功能 正常
image
全部数据为中文日期格式时,选框功能 异常,操作选框后,其它view数据不显示
image

@hustcc
Copy link
Member

hustcc commented Dec 6, 2022

这是数据为日期的时候才能通过筛选,而内置判断日期的方式就是取数据第一个尝试正则匹配,无法覆盖全部情况。所以保险的做法是:

  1. 指定为日期类型
chart.scale('date', { type: 'date' })
  1. 将数据的中日期格式,转成 new Date 类型。

@hustcc hustcc closed this as completed Dec 6, 2022
@zhaoqi5757
Copy link
Author

image
我尝试了你的方式,还是不行。

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

No branches or pull requests

2 participants