AdeelK93 / collapsibleTree

Create Interactive Collapsible Tree Diagrams in R using D3.js
https://adeelk93.github.io/collapsibleTree/
158 stars 41 forks source link

Add option to get fields from data.tree fieldsAll #26

Open open3dgenome opened 6 years ago

open3dgenome commented 6 years ago

My apologies if this request just reflects my lack of familiarity with data.tree.

The data.tree objects that I usually generate are made by using as.Node() and these objects lack any information at the df$fields, rendering the fill argument useless on the method collapsibleTree/R/collapsibleTree.data.tree.R. Being able to choose between df$fields or df$fieldsAll can guarantee that different data.tree objects can be plotted.

I confirm that by changing df$fields to df@fieldsAll the nodes are properly colored.

AdeelK93 commented 6 years ago

Hmmm you bring up an interesting point. The only time df$fields and df$fieldsAll should differ is if there's null values in the root. I suppose I could change the collapsibleTree.data.tree to use df$fieldsAll and allow nulls, but I'm not totally convinced that's the best idea.

When you change df$fields to df$fieldsAll, I'm assuming the root node's color is wrong?