antvis/G2
The issue has been closed
sliderFilter 的 axis 隐藏策略不是自动隐藏 #4848
pearmini posted onGitHub
<img src="https://user-images.githubusercontent.com/49330279/228446938-dc0d581a-1f44-45c2-9a46-30ef650f8104.png" width=640 />
export function aaplLineSliderFilter(): G2Spec {
return {
type: 'line',
paddingLeft: 80,
data: {
type: 'fetch',
value: 'data/aapl.csv',
},
encode: {
x: (d) => new Date(d.date),
y: 'close',
},
axis: {
x: { title: false, size: 40 },
y: { title: false, size: 36 },
},
slider: {
x: { labelFormatter: (d) => format(d, 'YYYY/M/D') },
y: { labelFormatter: '~s' },
},
};
}
实现
代码里面的策略是自动隐藏,如下:
<img src="https://user-images.githubusercontent.com/49330279/228447209-6bf709d6-8127-4fa9-a1d8-bc33d6d8f616.png" width=400 />
TODO
包括 brushFilter 和 fisheye 这种坐标轴会更新的交互,都应该默认为隐藏策略,防止溢出。所以对下面的交互都需要确定。
- sliderFilter
- fisheye
- brushFilter
- 测试