chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
data.sort((b, a) => a.value - b.value);
svg.selectAll('rect')
.data(data)
.enter().append('rect')
.style("fill", d => scale.c(d.value))
.attr("x", d => scale.x(d.name))
.attr("width", scale.x.bandwidth())
.attr("y",d => scale.y(d.value))
.attr("height", d => scale.y(0) - scale.y(d.value));
svg.append("g")
.call(xAxis)
.selectAll('text')
.style('text-anchor', 'end')
.attr('dx', '-.8em')
.attr('dy', '.15em')
.attr('transform', 'rotate(-65)');
svg.append("g")
.call(yAxis);
return svg.node();
}