antvis/G2




The issue has been closed
切换浏览器标签页后切换回来后图表显示空白 #3811
ckvv posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
切换浏览器标签页后切换回来后图表显示空白, 鼠标hover后才显示
Reproduction
https://codepen.io/chenkai0520/full/OJjGEQK
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>折线图-issue</title>
</head>
<body>
<div id="container" style="width: 1079px; height: 312px;"></div>
<script src="https://gw.alipayobjects.com/os/lib/antv/g2/4.1.32/dist/g2.min.js"></script>
<script>
const data = [{
date: '2021-11-19',
value: 995.023
},
{
date: '2021-11-18',
value: 1021.899
},
{
date: '2021-11-17',
value: 948.366
},
{
date: '2021-11-16',
value: 947.162
},
{
date: '2021-11-15',
value: 1003.01
},
{
date: '2021-11-14',
value: 1072.513
},
{
date: '2021-11-13',
value: 1164.065
}
];
const chart = new G2.Chart({
container: 'container',
autoFit: true,
});
chart.data(data);
chart.scale({
date: {
range: [0, 1],
},
value: {
min: 0,
nice: true,
},
});
chart.tooltip({
showCrosshairs: true, // 展示 Tooltip 辅助线
shared: true,
});
chart.line().position('date*value').label('value');
chart.point().position('date*value');
chart.render();
</script>
</body>
</html>
<img width="1431" alt="截屏2022-02-16 下午3 20 23" src="https://user-images.githubusercontent.com/30174970/154215516-80568fde-e2e7-49b2-ad7d-218e6d87bf68.png">
Environment | Info |
---|---|
g2 | 4.1.34 |
System | MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports) |
Browser | Google Chrome 版本 98.0.4758.80(正式版本) (x86_64) |