diff --git a/src/runtime/render.ts b/src/runtime/render.ts index ed5482fb21..f2459e0a25 100644 --- a/src/runtime/render.ts +++ b/src/runtime/render.ts @@ -139,11 +139,11 @@ export function renderToMountedElement( // Make sure that plot chart after container is ready for every time. plot({ ...keyed, width, height }, selection, library, context) .then(() => { - setTimeout(() => { - // Wait for the next tick. + const canvas = group.ownerDocument.defaultView; + canvas.requestAnimationFrame(() => { emitter.emit(ChartEvent.AFTER_RENDER); resolve?.(); - }, 20); + }); }) .catch((e) => { reject?.(e);