chart = {
const width = 600;
const height = 300;
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("width", width);
const x = d3
.scaleLinear()
.domain([0, d3.max(dataset)])
.range([0, width - 50]);
const y = d3.scaleBand().domain(dataset).range([0, height]).padding(0.1);
svg
.selectAll("rect")
.data(dataset)
.join("rect")
.attr("y", y)
.attr("width", x)
.attr("height", y.bandwidth())
.attr("fill", "orange");
svg
.selectAll("text")
.data(dataset)
.join("text")
.attr("x", x)
.attr("y", (d) => y(d) + y.bandwidth())
.attr("dy", "-0.4em")
.attr("dx", "0.5em")
.text((d) => d);
return svg.node();
}