chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.call(zoom);
svg.append("g")
.attr("class", "bars")
.attr("fill", "steelblue")
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", d => x(d.name))
.attr("y", d => y(d.value))
.attr("height", d => y(0) - y(d.value))
.attr("width", x.bandwidth());
svg.append("g")
.attr("class", "x-axis")
.call(xAxis);
svg.append('rect')
.attr('x', 0)
.attr('y', 0)
.attr('width', margin.left)
.attr('height', height)
.attr('fill', 'white')
svg.append("g")
.attr("class", "y-axis")
.call(yAxis);
return svg.node();
}