[Bug]: 我现在需要一个 双x轴的功能,底部x轴按小时分段,顶部x轴按天分段,两个x轴在0点对齐,我现在通过x轴time类型实现后,拉伸slider后两个x轴的对齐点为当前x轴起始的时刻,我现在使用版本为4.2.1
- Dominant language
- TypeScript
- Stars
- 12.6k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug / 问题描述
chart.scale({
x: {
type: 'time', // 声明为时间比例尺
mask: 'YYYY-MM-DD HH:mm', // 与数据中的时间格式一致
tickInterval: 86400000,
},
'时间':{
type: 'time', // 声明为时间比例尺
mask: 'HH:mm', // 与数据中的时间格式一致
tickInterval: 3600000,
},
})
chart.axis('x',{
position: 'top',
grid: {
alignTick: true,
line:{
type:'line',
style:{
opacity:0.3
}
}
},
label: {
formatter: (value) => dayjs(value).format('MM-DD'), // 提取日期部分
},
scale: 'x'
})
chart.axis('时间',{
position: 'bottom',
scale: '时间', // 明确指定使用 x 的 scale
})
chart.line().position('x*时间*value_test').color('type', (value) => {
return '#ffffff00';
})
chart.option('slider',{
start: 0,
end: 1
})
### Reproduction link / 复现链接
_No response_
### Steps to Reproduce the Bug or Issue / 重现步骤
运行代码后,在起始位置拉伸slider,改变x轴起始点数值,两个x轴不会按0点对齐
### Version / 版本
4.x
### OS / 操作系统
- [x] macOS
- [x] Windows
- [ ] Linux
- [ ] Others / 其他
### Browser / 浏览器
- [x] Chrome
- [x] Edge
- [x] Firefox
- [x] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他
Contributor guide
Research direction
Start with the provided chart.scale, chart.axis, line positioning, and slider configuration on G2 4.2.1, then reproduce the issue by moving the slider's start position. The work is done when the top daily axis and bottom hourly axis remain aligned at zero after the slider changes the x-axis start.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100