chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
const pattern = svg.append('pattern')
.attr('id', 'pattern')
.attr('x', 0)
.attr('y', 0)
.attr('width', 50)
.attr('height', height)
.attr('patternUnits', 'userSpaceOnUse');
const ticks = y.ticks();
const yTickHeight = y(ticks[0]) - y(ticks[1]);
pattern.selectAll('rect').data(y.ticks())
.join('rect')
.attr('x', 0)
.attr('y', d => y(d))
.attr('width', 50)
.attr('height', yTickHeight)
.attr('fill', color);
svg.append("g")
.attr("fill", `url(${new URL("#pattern", location)})`)
.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")
.call(xAxis);
svg.append("g")
.call(yAxis);
return svg.node();
}