antvis/G2




The issue has been closed
[v5] tooltip 线跟鼠标位置相反 #4434
Valar103769 posted onGitHub
render: (container: string | HTMLDivElement) => {
if (!container) {
console.error('container 不存在')
return
}
const chart = new Chart({
container: container,
autoFit: true,
})
const line1 = chart
.line()
.data(response.data1)
.encode('x', (d) => Number(dayjs(d.hour, 'YYYY-MM-DD HH').format('HH')))
.encode('y', 'new_recharge_orders')
.encode('shape', 'smooth')
.axis('x', { title: '时间' })
.axis('y', { title: '充值金额' })
// const line2 = chart
// .interval()
// .data(response.data2)
// .encode('x', 'x')
// .axis('x', { title: '时间' })
// .encode('y', 'new_recharge_orders')
// .encode('shape', 'smooth')
console.log('line1', line1.value)
chart.interaction({
type: 'tooltip',
})
chart.render()
},