{
const svg = d3.select(chartElement);
const marksArea = svg.selectAll("g.marksArea").data([1])
.join("g")
.attr("class", "marksArea");
const groups = marksArea.selectAll("g.datapoint")
.data(brandsOfYear_top20, d => d.name)
.join(
enter => enter.append("g")
.attr("class", "datapoint")
.attr("transform", (d) => `translate(${brandsX(0)}, ${brandsY.range()[1]})`)
.call(appendBars),
update => update.call(updateBars),
exit => exit.remove()
)
.call(
groups => groups.transition().duration(transitionDuration)
.attr("transform", (d) => `translate(${brandsX(0)}, ${brandsY(d.name)})`)
);
svg.selectAll("g.axisLeft").data([1])
.join("g")
.attr("class", "axisLeft")
.attr("transform", `translate(${margin.left}, 0)`)
.transition().duration(transitionDuration).ease(d3.easeLinear)
.call(d3.axisLeft(brandsY));
svg.selectAll("g.axisBottom").data([1])
.join("g")
.attr("class", "axisBottom")
.attr("transform", `translate(0, ${height - margin.bottom})`)
.transition().duration(transitionDuration)
.call(d3.axisBottom(brandsX));
return svg.node();
}