const drawBars = () => {
svg.selectAll(“rect”)
.data(data)
.enter()
.append(“rect”)
.attr(“class”, “bar”)
.attr(“width”, (w - 2 * p) / data.length)
.attr(“data-date”, (d) => d[0])
.attr(“data-gdp”, (d) => d[1])
.attr(“height”, (d) => {
return yScale(d[1]);
})
.attr(“x”, (d, i) => xScale(i))
.attr(“y”, (d) => {
return h - p - yScale(d[1]);
})
.append(‘title’)
.attr(‘data-date’, d=>d[0])
.text(d=>d[0])}
This is my code that generates the bars. The tooltip is being displayed correctly on screen but it is not passing the tests.