J86
J86

Reputation: 15257

Partition has a blank slice

I am just starting out with the d3 library and want to achieve what is called a Bilevel Partition.

So I copied the code from the page and structured my JSON file to have the exact same structure as the JSON file used on the example page. So my JSON file also has the keys (e.g. name and children).

All seems to work until I click to navigate to the 2nd level, then all of a sudden I see that a slice is missing!

Here is a screencast of what I mean. Also when I click the centre, it does not navigate back to the 1st level and after debugging I can see that the fault is the missing slice! The error I get in the chrome console is:

console error

It occurs on line 767 in the uncompressed d3.js.

Why am I getting this error and how I can solve it?

Upvotes: 1

Views: 46

Answers (1)

J86
J86

Reputation: 15257

It turns out the reason was that I had a child repeated in my original data set!

"children" : [
{
    "name": "Citrus",
    "children": [
        {
            "Name": "Oranges",
            "size": 60
        },
        {
            "Name": "Lemons",
            "size": 35
        },
        {
            "Name": "Limes",
            "size": 30
        },
        {
            "Name": "Limes",
            "size": 40
        }
    ]
},

Once I fixed that, all was good.

Upvotes: 1

Related Questions