{
const svg = d3.create('svg')
.attr('width', 500)
.attr('height', 330);
const rows = svg.selectAll('g')
.data(shapeInfo.rows)
.join('g')
.attr('transform', row => `translate(0,${row.y})`);
rows.append('rect')
.attr('width', shapeInfo.rectWidth)
.attr('height', shapeInfo.rectHeight)
.attr('fill', row => row.color);
rows.selectAll('circle')
.data(row => row.circles)
.join('circle')
.attr('r', shapeInfo.circleRadius)
.attr('cy', shapeInfo.rectHeight / 2)
.attr('cx', circle => circle.x)
.attr('fill', circle => circle.color);
return svg.node();
}