Uncaught TypeError: d3.scaleOrdinal is not a function

Viewed 3188

I want to color the dots in a scatterplot according to the domain, but I get the error : Uncaught TypeError: d3.scaleOrdinal is not a function

var colors =  ["#63b598", "#ce7d78", "#ea9e70"];
var  color = d3.scaleOrdinal().domain(['a','b','c']).range(colors);
svg.selectAll(".dot")
  .data(data)
.enter().append("circle")
  .attr("class", "dot")
  .attr("r", 3.5)
  .attr("cx", xMap)
  .attr("cy", yMap)
  .style("fill", function(d){ return color(d.category)})
1 Answers

Solved. I replaced d3.scaleOrdinal() by d3.scale.ordinal() .

Related