Accepted answer

There's a really good post that someone put together about using canvas called Working with D3.js and Canvas.

In short I'd recommend doing some data-binding into some dummy HTML, and using the results of this to render your output.

First create a fake DOM element that you can use

const fakeContainer ="custom"));

Now data-bind to it. Note, only create it the once, re-use it for re-renders.

const join = fakeContainer


Then when it comes to rendering:

fakeContainer.each(function(d) {
    // Render a canvas circle

Related Query