I'm trying to draw axes on a graph but when I append svg with g with the following line, I receive an error of TypeError: d.join is not a function
:
svg.append("g")
.attr("transform", "translate(0," + height / 2 + ")")
.call(xAxis);
svg.append("g")
.attr("transform", "translate(" + width / 2 + ",0)")
.call(yAxis);
However, when I delete these lines, error disappears. Any ideas on how to solve this? Here is the DEMO.
Thank you!
This line is causing the problem:
This is selecting all the
path
elements of the svg. When you add the axis, they also contain path elements that are being selected but aren't part of the voronoi. The solution is to make this selector more specific:Updated example here.