这张照片是我用dTree.js创建的一个家谱图表;有两个母亲;但这不是我想要的;
这是我的代码
[
{
"name": "granddad",
"class": "man",
"textClass": "emphasis",
"marriages": [
{
"spouse": {
"name": "grandmother",
"class": "woman"
},
"children": [
{
"name": "aunt",
"class": "woman"
},
{
"name": "uncle",
"class": "man"
},
{
"name": "father",
"class": "man",
"marriages": [
{
"spouse": {
"name": "mother",
"class": "woman",
"id": 3
},
"children": [
{
"name": "sister",
"class": "woman"
},
{
"name": "me",
"class": "man"
},
{
"name": "brother",
"class": "man",
"hidden": true
}
]
}
]
}
]
}
]
},
{
"name": "grandfather",
"class": "man",
"textClass": "emphasis",
"marriages": [
{
"spouse": {
"name": "grandmother",
"class": "woman"
},
"children": [
{
"name": "mother",
"class": "woman",
"id": "3"
},
{
"name": "aunt",
"class": "woman"
}
]
}
]
}
<script>
var data_json = '/admin/test/json';
treeJson = d3.json(data_json, function (error, treeData) {
dTree.init(treeData, {
target: "#graph",
debug: true,
height: 800,
width: 1200,
callbacks: {
nodeClick: function (name, extra) {
console.log(name);
}
}
});
});
我想创建一个这样的图表:只有一位母亲与父亲结婚;
https://i.stack.imgur.com/db8I3.jpg
我该怎么办?