chart = {
let plot = d3.create('svg')
.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom);
plot.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`)
.attr('class', 'axis axis-y')
.call(yAxis);
plot.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top + height})`)
.attr('class', 'axis axis-x')
.attr('class', 'domain')
.attr('x1', 0)
.attr('x2', width)
.attr('y1', 0)
.attr('y2', 0)
.call(xAxis);
plot.select('.axis-y')
.selectAll('path')
.style('display', 'none');
plot.select('.axis-y')
.selectAll('line')
.style('stroke-width', 1)
.style('stroke', '#d4d4d4');
plot.select('.axis-x')
.selectAll('line')
.style('stroke-width', '2')
.style('stroke', '#222222');
plot.select('.axis-x')
.selectAll('text')
.style('font-size', '1rem');
plot.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`)
.attr('class', 'dots');
plot.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`)
.attr('class', 'percentages');
plot.append('g')
.attr('transform', `translate(0, 25)`)
.attr('class', 'legend');
const plotLegend = plot.select('.legend');
plotLegend.selectAll('text').remove();
plotLegend.append('text')
.text(statement)
.attr('x', width - 5)
.attr('text-anchor', 'end')
.style('font-family', 'Helvetica, sans-serif')
.style('fill', '#222222');
const drawingData = createData();
drawDots(plot, drawingData);
return plot.node();
}