antvis/G2

Do you want to work on this issue?

You can request for a bounty in order to promote it!

异步多次render和clear,出现不能渲染 #6625

sanye-huang posted onGitHub

测试案例

` import { Chart } from '@antv/g2';

const chart = new Chart({ container: 'container' });

chart.options({ type: "interval", data: [ { genre: "Sports", sold: 0 }, { genre: "Strategy", sold: 115 }, { genre: "Action", sold: 120 }, { genre: "Shooter", sold: 350 }, { genre: "Other", sold: 150 }, ], encode: { x: "genre", y: "sold", color: "genre" }, style: { minHeight: 50 }, });

chart.render();

setTimeout(() => { chart.clear(); chart.options({ type: "interval", data: [ { genre: "Sports", sold: 0 }, { genre: "Strategy", sold: 115 }, { genre: "Action", sold: 120 }, { genre: "Shooter", sold: 350 }, { genre: "Other", sold: 150 }, ], encode: { x: "genre", y: "sold", color: "genre" }, style: { minHeight: 50 }, }); chart.render(); }, 10) `


应该和异步渲染时序有关,如果只是想清除配置,可以先尝试用 chart._reset 代替 chart.clear

posted by moayuisuda about 2 months ago

我使用了 chart._reset 后可以解决问题

posted by mingzizhennimafan 24 days ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests