The DPR-aware <canvas> primitive every chart draw layer sits on. It sizes
the backing buffer to width*dpr × height*dpr, keeps the CSS box at
width × height, applies setTransform(dpr, …) so the CanvasDraw
callback works in CSS-pixel coordinates, clears, and calls draw.
Drawing runs in useLayoutEffect (synchronous, before paint) so there is no
flash of an unsized or empty canvas. Setting canvas.width/height resets
all context state, so the transform is re-applied on every run — see trap #7
in docs/rfcs/charts.md.
The DPR-aware
<canvas>primitive every chart draw layer sits on. It sizes the backing buffer towidth*dpr × height*dpr, keeps the CSS box atwidth × height, appliessetTransform(dpr, …)so the CanvasDraw callback works in CSS-pixel coordinates, clears, and callsdraw.Drawing runs in
useLayoutEffect(synchronous, before paint) so there is no flash of an unsized or empty canvas. Settingcanvas.width/heightresets all context state, so the transform is re-applied on every run — see trap #7 indocs/rfcs/charts.md.