{
const svg = d3.create('svg')
.attr('width', width)
.attr('height', height);
svg.selectAll('rect')
.data(countryToPopulation)
.join('rect')
.attr('x', x(0))
.attr('y', ([country, population]) => y(country))
.attr('width', ([country, population]) => x(population) - x(0))
.attr('height', y.bandwidth())
.attr('fill', 'steelblue');
svg.append('g')
.attr('transform', `translate(${margin.left})`)
.call(yAxis)
.call(g => g.select('.domain').remove());
svg.append('g')
.attr('transform', `translate(0, ${height - margin.bottom})`)
.call(xAxis)
.call(g => g.select('.domain').remove())
.append('text')
.attr('fill', 'black')
.attr('font-family', 'sans-serif')
.attr('x', width / 2)
.attr('y', 40)
.text("Population");
return svg.node();
}