autobarWithMarginAndAxes = {
const svg = d3.create("svg")
.attr("width", width + margin.left)
.attr("height", y.range()[1])
.attr("font-family", "sans-serif")
.attr("font-size", "10")
.attr("text-anchor", "end")
.style('border', '1px dotted #999');
const bar = svg.selectAll("g")
.data(data)
.join("g")
.attr("transform", (d, i) => `translate(0,${yMargin(i)})`);
bar.append("rect")
.attr("fill", "steelblue")
.attr("x", xMargin(0))
.attr("width", (d) => (xMargin(d) - margin.left))
.attr("height", yMargin.bandwidth() - 1);
bar.append("text")
.attr("fill", "white")
.attr("x", d => xMargin(d) - 4)
.attr("y", yMargin.bandwidth() / 2)
.attr("dy", "0.35em")
.text(d => d);
svg.append('g')
.attr('transform', `translate(0, ${height - margin.bottom})`)
.call(d3.axisBottom(xMargin));
svg.append('g')
.attr('transform', `translate(${margin.left}, 0)`)
.call(d3.axisLeft(yMargin));
return svg.node();
}