Maximum call stack size exceedded

453 views
Skip to first unread message

vincenzo

unread,
Jul 9, 2011, 11:46:53 AM7/9/11
to d3-js
When I render one of our force directed graphs I get the following
JavaScript Error.

RangeError: Maximum call stack size exceeded.

Its not the biggest system we have. Any ideas what might be causing
this.

I can post the file if anyone is interested in looking at it.

Thanks

Mike Bostock

unread,
Jul 9, 2011, 12:25:47 PM7/9/11
to d3...@googlegroups.com
This is usually the quadtree recursing infinitely because one of the
node positions is NaN. We could change the quadtree to ignore these
nodes, but that would just cause a different error (the node being
positioned in the top-left corner and an SVG parse error). Are you
applying any custom forces or initializing node positions?

Mike

Vincenzo Menanno

unread,
Jul 9, 2011, 2:24:09 PM7/9/11
to d3...@googlegroups.com
Hi Mike,

On Jul 9, 2011, at 9:25 AM, Mike Bostock wrote:

> This is usually the quadtree recursing infinitely because one of the node positions is NaN. We could change the quadtree to ignore these nodes, but that would just cause a different error (the node being positioned in the top-left corner and an SVG parse error). Are you applying any custom forces or initializing node positions?

I can think of two things that we changed.

We added:

.friction(.1)

And in looking to stroke the path and fill it we did this but we only were able to stroke the path. We ended up solving the fill as well but not yet implemented.

Do you think this is where the problem might be?

var node = vis.selectAll("path")
.data(json.nodes)
.enter().append("svg:path")//.append("svg:circle")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; })
.attr("d", d3.svg.symbol()
.size(function(d) { return d.size? d.size :200; })
.type(function(d) { return d.type? d.type:"circle"; }))
.style("fill", function(d) {return d.color? d3.rgb(d.color) :fill(d.group); })
.style("stroke", function(d) {return d.fullAccess?"black":"white";})
.style("stroke-width", function(d) {return d.fullAccess?"2px":"1.5px";})
.call(force.drag);

/* .attr("class", "node")
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; })
.attr("r", function(d) {return d.size? d.size :5; })
.style("fill", function(d) {return d.color? d3.rgb(d.color) :fill(d.group); })
.call(force.drag); */


vincenzo

unread,
Jul 13, 2011, 5:15:50 PM7/13/11
to d3-js
I could really use another pair of eyes on this... if someone wants to
take a crack at it.

Help!!!

Giovanni Gaglione

unread,
Apr 2, 2013, 3:10:19 AM4/2/13
to d3...@googlegroups.com
Up. I have the same problem.

Micah Stubbs

unread,
Aug 31, 2015, 5:40:35 PM8/31/15
to d3-js
I'll share a solution I found today - know this is an old thread :-)


Generally, stack overflow errors and quadtrees mean that you're adding an element outside of the quadtree's extent. Are you sure you're calculating the x_scale domain and range correctly, so that all your x values will be within the range you're using for the extent? –  AmeliaBR May 8 '14 at 4:41

 In my case, I was using my width and height variables to set the extent of the quadtree. Like AmeliaBR says, this was a problem since my width variable was less than the total width of the chart area.  I was subtracting left and right margins to come up with the variable I called width.  

If I use the total width of the chart area to set the extent of the quadtree, the Maximum call stack size exceeded error goes away.


@micahstubbs

Reply all
Reply to author
Forward
0 new messages