antvis/G2

【需求】区间条形图(interval)配置的滑块(Slider)支持改变坐标轴刻度间隔 #3776

dlspacezero posted onGitHub

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

What problem does this feature solve?

期望在类似时间条形图( https://g2-v4.antv.vision/zh/examples/bar/basic#time-bar )的图形上,通过slider 改变时间轴的刻度线间隔,而不是截取一段刻度。

What does the proposed API look like?

chart.option('slider', { type: 'time', });

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


表述不太明确?本意是希望 slider 在做过滤的时候,对应的任务不要被过滤掉是么?

posted by visiky about 3 years ago

感觉跟我想要的需求有点类似,开始数据对应的时间跨度比较大,绘制的时候x轴间隔以天为单位,当拖拽slidier缩小范围的时候,过滤后的数据都在一天内,这时候x轴能自动变成小时为间隔就好了,目前g2还是以天为间隔

posted by zhgw01 almost 3 years ago

数据的 x 轴是日期类型,日期类型其实是连续的,所以在 slider 滑动范围的时候,两个日期之间的间距是有变化的。但是当前不会对日期展示的文本有变化。

所以做法有的,但是很难处理精确:判断 slider 当前的 start end,然后根据 start end 的大小,来决定 axis 的格式化方式。

chart.axis('x', { label: { formmatter: () => {} } })
posted by hustcc over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests