chart = {
const svg = d3.create('svg')
.attr('width', width)
.attr('height', height);
const g = svg.selectAll('g')
.data(nested2)
.join('g')
.attr('class', (d) => `family-${d.key}`)
.attr('fill', (d) => color(d.key))
.attr('transform', (d, i) => `translate(0, ${i * (fontSize + spacing) + i * d.nLines * 2 * radius})`)
g.append('text')
.text((d) => `Family ${d.key}`)
.attr('alignment-baseline', 'hanging')
.attr('fill', 'black')
.style('font-size', fontSize);
g.selectAll('circle')
.data((d) => d.values)
.join('circle')
.attr('cx', (d, i) => familyWidth + i % maxCirclesInLine * (radius * 2 + spacing / 4))
.attr('cy', (d, i) => radius + (radius * 2 + spacing / 4) * Math.floor(i / maxCirclesInLine))
.attr('r', radius);
return svg.node();
}