In my JSON file, I have the following data structure:
{
"children": [
{
"name": "المصاريف",
"children": [
{"name": "بنزين","size": 14230,"colour": "rgb(220,230,180)"},
{"name": "تاكسي","size": 25220,"colour": "rgb(220,230,200)"},
{"name": "شاي","size": 30523,"colour": "rgb(220,230,220)"}
]
},
{
"name": "الدخل",
"children": [
{"name": "مرتب","size": 50657,"colour": "rgb(150,230,180)"},
{"name": "ايجار","size": 24320,"colour": "rgb(150,230,200)"},
{"name": "مصنع","size": 163460,"colour": "rgb(150,230,220)"}
]
},{
"name": "الربح","size": 168464,"colour": "rgb(180,230,220)"}
]
}
The issue arises from the root object not having a name. When binding the data using
.data(partition.nodes(root))
I need to exclude the first node in my D3 chart.
In other words, any node with a null name or an empty node should be disregarded in the legend. Here is a screenshot of the problem: