Skip to content Skip to sidebar Skip to footer

D3js Collapsible Tree Throwing Bad Request

I am using the d3js collapsible tree grid to display the nodes and when I run the code in plunker I am getting a weird 400 bad request error. I have replaced the code which fetches

Solution 1:

Your code doesn't show any error in the console, here is an image to proof:

enter image description here

Still, nothing will show up. The reason is simple: you are calling your script...

<script src="dndTree.js"></script>

...before the <body>, where you have this div:

<div id="tree-container"></div>

Which is the div used to create the svg:

var baseSvg = d3.select("#tree-container").append("svg")

So, this is the correct order:

<body>
    <div id="tree-container"></div>
    <script src="dndTree.js"></script>
</body>

As a good practice, reference your script at the bottom of the body.

Here is the working plunker (and I emphasise "working"): http://plnkr.co/edit/2aLPBuEXN9f6Tlwekdg5?p=preview


Post a Comment for "D3js Collapsible Tree Throwing Bad Request"