-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug / 问题描述
https://g2.antv.antgroup.com/examples/general/area/#area-basic
当添加如下配置,x值是第一个数据时,图表无法在加载完成后自动提示。
但,当将x值调整为1992或者不是第一个数据时,图表能正常加载完成后自动提示。
chart.once('afterrender', () =>
chart.emit('tooltip:show', {
data: {
data: {
x: '1991'
}
}
})
);
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
import { Chart } from '@antv/g2';
const data = [
{ year: '1991', value: 15468 },
{ year: '1992', value: 16100 },
{ year: '1993', value: 15900 },
{ year: '1994', value: 17409 },
{ year: '1995', value: 17000 },
{ year: '1996', value: 31056 },
{ year: '1997', value: 31982 },
{ year: '1998', value: 32040 },
{ year: '1999', value: 33233 },
];
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.data(data);
chart
.area()
.encode('x', (d) => d.year)
.encode('y', 'value')
.encode('shape', 'area') // 'area', 'smooth', 'hvh', 'vh', 'hv'
.style('opacity', 0.2)
.axis('y', { labelFormatter: '~s', title: false });
chart.line().encode('x', 'year').encode('y', 'value').encode('shape', 'line'); // 'line', 'smooth', 'vh', 'hv', 'hvh'
chart.once('afterrender', () =>
chart.emit('tooltip:show', {
data: {
data: {
x: '1991'
},
},
}),
);
chart.render();
Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他