I recently came across an interesting example of the "D3 Collapsible Force Layout" on this website. I decided to tweak the input data a bit:
const data = {
"name": "directory",
"children": [
{"name": "1st file",
"children": [{"name": "1f 1st function", "group": 1},
{"name": "1f 2nd function", "group": 1},
{"name": "1f 3rd function", "group": 1},
{"name": "1f 4th function", "group": 1}], "group": 1,},
{"name": "2nd file", "children": [
{"name": "2f 1st function", "group": 2},
{"name": "2f 2nd function", "group": 2}], "group": 2},
{"name": "3rd file", "children": [
{"name": "3f 1st function", "group": 3}
], "group": 3},
{"name": "4th file", "children": [
{"name": "4f 1st function", "group": 4},
{"name": "4f 2nd function", "group": 4},
{"name": "4f 3rd function", "group": 4}
], "group": 4}
],
"group": 0
}
I'm looking to assign specific colors to the parent-child nodes based on their group value. For example, nodes with "group:1" should be red, "group:2" should be green, and so on. Could someone help me achieve this? Appreciate your time and assistance.