Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript d3.js删除节点_Javascript_Html_D3.js - Fatal编程技术网

Javascript d3.js删除节点

Javascript d3.js删除节点,javascript,html,d3.js,Javascript,Html,D3.js,我有一个树组织,当我点击“Comparatif”树的一个蓝色矩形时,有时会删除一些数组(请参见firefox上单击蓝色矩形时对最后一个数组进行消隐),因此它会移动并删除Comparatif树上的一些数据,但如果我点击其他树的一个蓝色矩形,它不会删除任何节点,我不明白为什么 以下是代码(请在firefox浏览器上尝试此代码): B.json文件: {"attributes": "DPGF", "children": [{"attributes": "LOT: nom 13.CVC", "chil

我有一个树组织,当我点击“Comparatif”树的一个蓝色矩形时,有时会删除一些数组(请参见firefox上单击蓝色矩形时对最后一个数组进行消隐),因此它会移动并删除Comparatif树上的一些数据,但如果我点击其他树的一个蓝色矩形,它不会删除任何节点,我不明白为什么

以下是代码(请在firefox浏览器上尝试此代码):

B.json文件:

{"attributes": "DPGF", "children": [{"attributes": "LOT:  nom 13.CVC", "children": [{"attributes": "Tous_DPGF:  Profondeur 1", "children": [{"attributes": "Poste:  Rang Rang 1 | 19", "children": [{"attributes":"Prix unitaire | 0.0"}, {"attributes":"Unité | 19.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 1 |     40", "children": [{"attributes":"Prix unitaire | 20.0"}, {"attributes":"Unité | 20.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 1 |     44", "children": [{"attributes":"Prix unitaire | 21.0"}, {"attributes":"Unité | 23.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 1 |     49", "children": [{"attributes":"Prix unitaire | 24.0"}, {"attributes":"Unité |25.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 1 |     53", "children": [{"attributes":"Prix unitaire |26.0"}, {"attributes":"Unité |27.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 1 |     93", "children": [{"attributes":"Prix unitaire | 28.0"}, {"attributes":"Unité | 65.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}, {"attributes": "Tous_DPGF:  Profondeur 2", "children": [{"attributes": "Prix total", "children": [{"attributes":"Prix unitaire | 31.0"}, {"attributes":"Unité | 65.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}, {"attributes": "Tous_DPGF:  Profondeur 3", "children": [{"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire | 35.0"}, {"attributes":"Unité| 35.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire |36.0"}, {"attributes":"Unité |36.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire| 37.0"}, {"attributes":"Unité |37.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire    | 38.0"}, {"attributes":"Unité| 38.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire  |39.0"}, {"attributes":"Unité   |39.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire | 40.0"}, {"attributes":"Unité |41.0"}, {"attributes":"Quantité"}, {"attributes":"Prix total"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Prix unitaire             | 42.0"}]}]}]}]}]}]}]}]}
{"attributes": "DPGF", "children": [{"attributes": "LOT:  nom 13.CVC", "children": [{"attributes": "Tous_DPGF:  Profondeur 1", "children": [{"attributes": "Poste:  Rang Rang 1 |  32", "children": [{"attributes":"Debut_poste_Excel | 13.0"}, {"attributes":"Fin_poste_Excel | 19.0"}, {"attributes":"Mot_cle debut"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  49", "children": [{"attributes":"Debut_poste_Excel | 29.0"}, {"attributes":"Fin_poste_Excel | 20.0"}, {"attributes":"Mot_cle chauffage"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  52", "children": [{"attributes":"Debut_poste_Excel | 28.0"}, {"attributes":"Fin_poste_Excel | 23.0"}, {"attributes":"Mot_cle Préambule"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  45", "children": [{"attributes":"Debut_poste_Excel | 19.0"}, {"attributes":"Fin_poste_Excel |25.0"}, {"attributes":"Mot_cle Préambule"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  50", "children": [{"attributes":"Debut_poste_Excel |22.0"}, {"attributes":"Fin_poste_Excel |27.0"}, {"attributes":"Mot_cle production thermique"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  99", "children": [{"attributes":"Debut_poste_Excel | 34.0"}, {"attributes":"Fin_poste_Excel | 65.0"}, {"attributes":"Mot_cle chauffage"}, {"attributes":"Rang Rang 1"}, {"attributes": "Tous_DPGF:  Profondeur 2", "children": [{"attributes": "Poste:  Rang Rang 2", "children": [{"attributes":"Debut_poste_Excel | 31.0"}, {"attributes":"Fin_poste_Excel | 65.0"}, {"attributes":"Mot_cle Échangeur"}, {"attributes":"Rang Rang 2"}, {"attributes": "Tous_DPGF:  Profondeur 3", "children": [{"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel | 35.0"}, {"attributes":"Fin_poste_Excel| 35.0"}, {"attributes":"Mot_cle Manchon"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel |36.0"}, {"attributes":"Fin_poste_Excel |36.0"}, {"attributes":"Mot_cle Vanne"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel| 37.0"}, {"attributes":"Fin_poste_Excel |37.0"}, {"attributes":"Mot_cle Thermomètre"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel    | 38.0"}, {"attributes":"Fin_poste_Excel| 38.0"}, {"attributes":"Mot_cle Sonde"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel  |39.0"}, {"attributes":"Fin_poste_Excel   |39.0"}, {"attributes":"Mot_cle Soupape"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel | 40.0"}, {"attributes":"Fin_poste_Excel |41.0"}, {"attributes":"Mot_cle Pressostat"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel             | 42.0"}]}]}]}]}]}]}]}]}

谢谢你的帮助;)

有什么帮助吗??
{"attributes": "DPGF", "children": [{"attributes": "LOT:  nom 13.CVC", "children": [{"attributes": "Tous_DPGF:  Profondeur 1", "children": [{"attributes": "Poste:  Rang Rang 1 |  32", "children": [{"attributes":"Debut_poste_Excel | 13.0"}, {"attributes":"Fin_poste_Excel | 19.0"}, {"attributes":"Mot_cle debut"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  49", "children": [{"attributes":"Debut_poste_Excel | 29.0"}, {"attributes":"Fin_poste_Excel | 20.0"}, {"attributes":"Mot_cle chauffage"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  52", "children": [{"attributes":"Debut_poste_Excel | 28.0"}, {"attributes":"Fin_poste_Excel | 23.0"}, {"attributes":"Mot_cle Préambule"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  45", "children": [{"attributes":"Debut_poste_Excel | 19.0"}, {"attributes":"Fin_poste_Excel |25.0"}, {"attributes":"Mot_cle Préambule"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  50", "children": [{"attributes":"Debut_poste_Excel |22.0"}, {"attributes":"Fin_poste_Excel |27.0"}, {"attributes":"Mot_cle production thermique"}, {"attributes":"Rang Rang 1"}]}, {"attributes": "Poste:  Rang Rang 1 |  99", "children": [{"attributes":"Debut_poste_Excel | 34.0"}, {"attributes":"Fin_poste_Excel | 65.0"}, {"attributes":"Mot_cle chauffage"}, {"attributes":"Rang Rang 1"}, {"attributes": "Tous_DPGF:  Profondeur 2", "children": [{"attributes": "Poste:  Rang Rang 2", "children": [{"attributes":"Debut_poste_Excel | 31.0"}, {"attributes":"Fin_poste_Excel | 65.0"}, {"attributes":"Mot_cle Échangeur"}, {"attributes":"Rang Rang 2"}, {"attributes": "Tous_DPGF:  Profondeur 3", "children": [{"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel | 35.0"}, {"attributes":"Fin_poste_Excel| 35.0"}, {"attributes":"Mot_cle Manchon"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel |36.0"}, {"attributes":"Fin_poste_Excel |36.0"}, {"attributes":"Mot_cle Vanne"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel| 37.0"}, {"attributes":"Fin_poste_Excel |37.0"}, {"attributes":"Mot_cle Thermomètre"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel    | 38.0"}, {"attributes":"Fin_poste_Excel| 38.0"}, {"attributes":"Mot_cle Sonde"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel  |39.0"}, {"attributes":"Fin_poste_Excel   |39.0"}, {"attributes":"Mot_cle Soupape"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel | 40.0"}, {"attributes":"Fin_poste_Excel |41.0"}, {"attributes":"Mot_cle Pressostat"}, {"attributes":"Rang Rang 4"}]}, {"attributes": "Poste:  Rang Rang 4", "children": [{"attributes":"Debut_poste_Excel             | 42.0"}]}]}]}]}]}]}]}]}