# D3 - Tooltip Lesson Not Passing

**URL:** <https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [May 11, 2022, 2:07pm UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129 "2022-05-11T14:07:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CuriosityBard](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/curiositybard/32/259501_2.png) [@CuriosityBard](https://forum.freecodecamp.org/u/CuriosityBard)\
**Post date:** [May 11, 2022, 2:07pm UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129/1 "2022-05-11T14:07:56Z")

</div>

\*\* What’s happening:\*\*  
I understand the D3 tooltip lesson, and I’ve triple-checked my answer against the [help post](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-a-tooltip-to-a-d3-element/301470), but the lesson still won’t pass. The task was to add a title element to each bar and put the data into the tooltip with a callback function, and it appears to be working as it should in the preview.

None of the tests are passing, so I don’t have a direction to go in. I’ve tried with and without a semicolon at the end of the chain. My code appears to be exactly the same as the help post solution, but it still won’t work. I’ve slept on the problem, and searched around for someone facing the same issue, and I can’t figure out anything. Is there something I’m missing here? Or is there an error happening with the test itself?

\*\* Code so far, excluding HTML\*\*  
(my part of the code is between the comments)

```js
  const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

  const w = 500;
  const h = 100;

  const svg = d3.select("body")
                .append("svg")
                .attr("width", w)
                .attr("height", h);

  svg.selectAll("rect")
     .data(dataset)
     .enter()
     .append("rect")
     .attr("x", (d, i) => i * 30)
     .attr("y", (d, i) => h - 3 * d)
     .attr("width", 25)
     .attr("height", (d, i) => d * 3)
     .attr("fill", "navy")
     .attr("class", "bar")
     // Add your code below this line

     .append("title")
     .text((d) => d);

     // Add your code above this line

  svg.selectAll("text")
     .data(dataset)
     .enter()
     .append("text")
     .text((d) => d)
     .attr("x", (d, i) => i * 30)
     .attr("y", (d, i) => h - (d * 3 + 3))

```

\*\* Browser information:\*\*

User Agent is: `Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0`

**Challenge:** Add a Tooltip to a D3 Element

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![jeremy.a.gray](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremy.a.gray/32/181458_2.png) [@jeremy.a.gray](https://forum.freecodecamp.org/u/jeremy.a.gray)\
**Post date:** [May 12, 2022, 2:07am UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129/2 "2022-05-12T02:07:27Z")

</div>

That appears to be correct and passes the tests when I copy/paste your code (in recent vanilla chrome).

---

<div class="post-metadata">

**Author:** ![kinome79](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kinome79/32/262116_2.png) [@kinome79](https://forum.freecodecamp.org/u/kinome79)\
**Post date:** [May 12, 2022, 5:08am UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129/3 "2022-05-12T05:08:47Z")

</div>

Same here… I pasted what you had above, clicked “Run the tests” and it passed… I’m using Firefox Developers.

Maybe something has cached weird in your browser. Do you have a different browser you can try?

---

<div class="post-metadata">

**Author:** ![CuriosityBard](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/curiositybard/32/259501_2.png) [@CuriosityBard](https://forum.freecodecamp.org/u/CuriosityBard)\
**Post date:** [May 12, 2022, 1:09pm UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129/4 "2022-05-12T13:09:12Z")

</div>

Clearing my cache didn’t work, but using a private window did! Thanks for the input.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [November 11, 2022, 1:09am UTC](https://forum.freecodecamp.org/t/d3-tooltip-lesson-not-passing/508129/5 "2022-11-11T01:09:59Z")

</div>

Closed on November 11, 2022, 1:09am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
