# D3 Choropleth map not passing tests

**URL:** <https://forum.freecodecamp.org/t/d3-choropleth-map-not-passing-tests/231269>\
**Category:** General\
**Created:** [October 3, 2018, 9:14am UTC](https://forum.freecodecamp.org/t/d3-choropleth-map-not-passing-tests/231269 "2018-10-03T09:14:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnythrash](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/johnnythrash/32/102036_2.png) [@johnnythrash](https://forum.freecodecamp.org/u/johnnythrash)\
**Post date:** [October 3, 2018, 9:14am UTC](https://forum.freecodecamp.org/t/d3-choropleth-map-not-passing-tests/231269/1 "2018-10-03T09:14:16Z")

</div>

My D3 Choropleth map is only passing 5 tests even though it “works”.

[https://codepen.io/johnnythrash/pen/QZbmwB?editors=0010](https://codepen.io/johnnythrash/pen/QZbmwB?editors=0010)

The tests it is failing are:  
4. There should be at least 4 different fill colors used for the counties.  
_I tested this and found there to be 263 unique fill colors_  
5. My counties should each have “data-fips” and “data-education” properties containing their corresponding fips and education values.  
_I inspected many (but not all) county elements and they all have the data-fips and data-education properties corresponding to their county._  
6. My Choropleth should have a county for each provided data point.  
_I’m pretty sure this works considering I’m not getting any errors and counties appear to have generated properly._  
7. The counties should have data-fips and data-education values that match the sample data  
9. There should be at least 4 different fill colors used for the legend.  
_I’m using a linear gradient with 6 stops so there are definitely 4 different colors used._

It also fails the 2 tooltip tests. Functionally it works, when I mouseover a county it shows all of the relevant information.

1. I can mouse over an area and see a tooltip with a corresponding id=“tooltip” which displays more information about the area.
2. My tooltip should have a “data-education” property that corresponds to the “data-education” of the active area.

---

<div class="post-metadata">

**Author:** ![raphaeluziel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/raphaeluziel/32/84700_2.png) [@raphaeluziel](https://forum.freecodecamp.org/u/raphaeluziel)\
**Post date:** [December 27, 2018, 7:36pm UTC](https://forum.freecodecamp.org/t/d3-choropleth-map-not-passing-tests/231269/2 "2018-12-27T19:36:52Z")

</div>

The _class county attribute_ should be placed after you append the path, otherwise, I think the class will apply to the group as a whole, and not to the individual counties. This will make your Choropleth map pass all but the legend color test, which I think is not passing _because_ your using a linear gradient as opposed to individual, discrete colors. However, passing the tests I do not think is that important - your map IS totally functional without the changes I described, and looks quite good.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:06pm UTC](https://forum.freecodecamp.org/t/d3-choropleth-map-not-passing-tests/231269/4 "2021-01-17T20:06:56Z")

</div>

Closed on January 17, 2021, 8:06pm UTC


