chart = {
const svg = d3.create('svg')
.attr('viewBox', [0, 0, width, height])
.attr('style', 'font: 400 14px/1.5 "Work Sans", "Open Sans"; fill: #202630');
svg.append('g')
.selectAll('rect')
.data(data)
.join('rect')
.attr('fill', '#949494')
.attr('x', (d,i) => xScale(i))
.attr('y', d => yScale(d.value))
.attr('width', xScale.bandwidth())
.attr('height', d => yScale(0) - yScale(d.value))
.on('mouseover', function(){
d3.select(this)
.transition()
.duration(100)
.attr('fill', '#3c72d7');
})
.on('mouseout', function(){
d3.select(this)
.transition()
.duration(number)
.attr('fill', '#949494');
})
svg.append('g').call(xAxis);
svg.append('g').call(yAxis);
svg.append('line').attr('stroke', '#953159')
.attr('x1', margin.left)
.attr('y1', median)
.attr('x2', width)
.attr('y2', median);
svg.append("text")
.attr("transform", `translate(${width - 24}, ${median})`)
.attr("dy", "-0.5em")
.attr("text-anchor", "end")
.style("fill", "#953159")
.html("Median = " + d3.format(".2%")(yScale.invert(median)));
svg.append("text")
.attr("transform", `translate(0, 0)`)
.attr("dy", "1em")
.attr("text-anchor", "start")
.style("fill", "#202630")
.style("font-size", 18)
.html("Relative frequency of letters in the English language");
return svg.node();
}