D3.js t.map is not a function

Hope someone can help me because I cannot find any links to this error.

I worked on this piece of code:

var xMin = d3.min(data, function(d) { return d.value; }); var xMax = d3.max(data, function(d) { return d.value; }); if (0 > xMin & 0 > xMax) { xMax = 0; } if (0 < xMin & 0 < xMax) { xMin = 0; } x.domain(xMin, xMax).nice(); y.domain(data.map(function(d) { return d.label; })); 

but I must have made a mistake, now I load the blocks with the error message below in the web console:

"TypeError: t.map is not a function @ http://d3js.org/d3.v3.min.js:2

+8
javascript
source share
1 answer

.domain() takes an array as an argument, i.e.

 x.domain(xMin, xMax).nice(); 

it should be

 x.domain([xMin, xMax]).nice(); 
+14
source share

All Articles