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

[feature]时间类型堆叠条形图 #4165

Closed
IcyW opened this issue Sep 21, 2022 · 3 comments
Closed

[feature]时间类型堆叠条形图 #4165

IcyW opened this issue Sep 21, 2022 · 3 comments

Comments

@IcyW
Copy link

IcyW commented Sep 21, 2022

请问是否已有支持时间类型的堆叠条形图模板例子?

所需功能:
1)多个条形同时展示
2)每个条形中可以根据时间展示为不同色块的时间阶段
3)横坐标展示为时间
4)支持slider调整时间,局部展示(如有更佳)

尝试过最靠近所需功能点的堆叠条形图,其中的数量即为两个阶段之间天数,但是还需要横坐标改为时间格式展示、且需要将tips改为时间段的展示。又或者data直接填例如2022-07-01这样的时间格式,但是横坐标的间隔并不是真实的时间天数,只是处理为普通枚举类型。
image

堆叠条形图:https://g2-v4.antv.vision/zh/examples/bar/stack#stacked
image

时间条形图:https://g2-v4.antv.vision/zh/examples/bar/basic#time-bar
image

@IcyW
Copy link
Author

IcyW commented Sep 21, 2022

相关问题: #4007 #3776 ,需要时间堆叠条形图: #3902

@IcyW
Copy link
Author

IcyW commented Sep 21, 2022

自问自答一下,
chart.scale("时间“, { type: time });
或许能解决这个问题?

@hustcc
Copy link
Member

hustcc commented Dec 6, 2022

这个需求实际是一个甘特图(gantt),所以 x 轴是任务的时间起止,确实解法就是你说的,设置时间的 scale 类型为 time 或者 datetime。

否则,会把 x 轴的数据当做一个文本,然后等间距,而不是根据时间去映射间距。

@hustcc hustcc closed this as completed Dec 6, 2022
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