JavaScript SVG has Fill of Black instead of mapped Color

I have a plot with many svg rects in my block. Most I were able to plot and fill just fine, however the initial rect is not blue like it is in my color map:

var colorMap = {
  0: "blue",
  1: "red",
  2: "yellow",
};

console.log() shows that the correct integer is being passed, and the correct color is being associated by the object. The other columns in my csv are floats, but the values for my color map are integers. The column has the header of id and takes on 1 of 3 values: 0,1 or 2.

I have read that this error can occur when the number is a float, not an integer. But to my knowledge, they are all integers. And even if my 0 entry is not an integer (for whatever reason) then why are all the other entries in that column working just fine? That would be very counter intuitive to have D3 recognize some numbers as floats and others as integers within the same exact column.

Perhaps it's not about integers/floats at all, could I be overlooking something else?

Answer:1

I'm having struggle accomplishing this : I want jQuery to grab class name of each icon and write it in each p element HTML <html> <head> <meta charset="utf-8"> <meta ...

I'm having struggle accomplishing this : I want jQuery to grab class name of each icon and write it in each p element HTML <html> <head> <meta charset="utf-8"> <meta ...

  1. set attribute value jquery
  2. set attribute value javascript
  3. set attribute value
  4. set attribute value in lightning component
  5. set attribute value js
  6. set attribute value dynamically c#
  7. set attribute value in selenium
  8. set attribute value using jquery
  9. set attribute value selenium python
  10. set attribute value c#
  11. set attribute value in lightning controller
  12. set attribute value javascript selenium
  13. set attribute value input javascript
  14. set attribute value using javascript
  15. set attribute value typescript
  16. set attribute value selenium java
  17. set attribute value javascript dynamics crm
  18. set attribute value input jquery
  19. set attribute value in angular 6
  20. set attribute value in oaf

I have the following code: http://jsfiddle.net/chris_bentley/21onnz5a/ <ul id="header-master-fixed-icon"> <li><a href="#" id="header-master-fixed-search" ></a></li> &...

I have the following code: http://jsfiddle.net/chris_bentley/21onnz5a/ <ul id="header-master-fixed-icon"> <li><a href="#" id="header-master-fixed-search" ></a></li> &...

  1. click show hide div
  2. click show hide div jquery
  3. click show hide angular
  4. click show hide javascript
  5. click show hide
  6. click show hide div using css
  7. click show hide css
  8. click show hide toggle
  9. click show hide div jquery demo
  10. button click show hide div
  11. ng-click show hide
  12. button click show hide div in angular 6
  13. vue click show hide
  14. click toggle show hide jquery
  15. checkbox click show hide div
  16. button click show hide div jquery
  17. ng-click show hide div
  18. button click show hide div in angularjs
  19. on click show hide div javascript
  20. js click show hide

I'm trying to embed a Juicer.io social feed on a page that uses bootstrap tooltips. For some reason, loading the juicer embed JS (//assets.juicer.io/embed.js) breaks the JS that initializes tooltips ...

I'm trying to embed a Juicer.io social feed on a page that uses bootstrap tooltips. For some reason, loading the juicer embed JS (//assets.juicer.io/embed.js) breaks the JS that initializes tooltips ...

I am working on a d3 visualization to create a sunburst. I am also adding a functionality to search for a particular arc so that the sunburst displays arcs with only the searched label. If the ...

I am working on a d3 visualization to create a sunburst. I am also adding a functionality to search for a particular arc so that the sunburst displays arcs with only the searched label. If the ...

  1. filter javascript object by value
  2. filter javascript object by key
  3. filter javascript object array
  4. filter javascript object
  5. filter javascript object by property
  6. javascript filter object by key value
  7. javascript filter object array by property value
  8. javascript filter object by property value
  9. filter object javascript es6
  10. filter object javascript lodash
  11. javascript filter object by multiple values
  12. javascript filter object attributes
  13. javascript filter object contains value
  14. javascript filter object by key name
  15. javascript filter object list
  16. javascript filter object array by key
  17. javascript filter object by multiple keys
  18. javascript filter object based on value
  19. javascript filter object entries
  20. javascript filter object example