Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
38
rated 0 times [  42] [ 4]  / answers: 1 / hits: 15969  / 11 Years ago, thu, june 13, 2013, 12:00:00

Hope somebody can help me out because I can't find any reference about this error.



I was working 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 some mistake cause now the loading 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



More From » d3.js

 Answers
12

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



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


should be



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

[#77637] Wednesday, June 12, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyreek

Total Points: 421
Total Questions: 115
Total Answers: 102

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
;