Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double counting in sund2b #78

Closed
monicarajamanohar opened this issue Sep 11, 2018 · 7 comments
Closed

Double counting in sund2b #78

monicarajamanohar opened this issue Sep 11, 2018 · 7 comments

Comments

@monicarajamanohar
Copy link

@monicarajamanohar monicarajamanohar commented Sep 11, 2018

Hi,
I was trying to execute the following and I found that sund2b double counts the pre-summed tree. In sunburst, there is an option sumNode = FALSE to avoid double counting of presummed trees.
How can I do the same with sund2b?
Thanks
Monica

library(treemap)
library(d3r)
rhd <- random.hierarchical.data()
tm <- treemap(
rhd,
index = paste0("index", 1:3),
vSize = "x",
draw = FALSE
)$tm
sund2b(
d3_nest(tm, value_cols = colnames(tm)[-(1:3)]),
colors = htmlwidgets::JS(
# yes this is a little different, so please pay attention
# "function(d) {return d.color}" will not work
"function(name, d){return d.color || '#ccc';}"
),
valueField = "vSize"
)

@timelyportfolio
Copy link
Owner

@timelyportfolio timelyportfolio commented Sep 11, 2018

Hi @monicarajamanohar I think this was fixed in d2b d2bjs/d2b@134079a. I will plan to update d2b tonight.

timelyportfolio added a commit that referenced this issue Sep 12, 2018
@timelyportfolio
Copy link
Owner

@timelyportfolio timelyportfolio commented Sep 12, 2018

@monicarajamanohar I updated d2b, and I believe it is fixed. Using the example from #62,

library(sunburstR)
library(d3r)

df <- data.frame(
  index1 = c(rep("A",3),"B"),
  index2 = c(NA,"A.1","A.1",NA),
  index3 = c(NA, NA, "A.1.1", NA),
  size = c(5,5,5, 10),
  stringsAsFactors = FALSE
)

sunburst(
  d3_nest(df, value_cols="size"),
  count = TRUE
)

sund2b(d3_nest(df, value_cols="size"))

image

I will try to prepare a CRAN release by the end of the weekend.

@monicarajamanohar
Copy link
Author

@monicarajamanohar monicarajamanohar commented Sep 12, 2018

Thank you for the prompt response. I will wait for the CRAN release

@monicarajamanohar
Copy link
Author

@monicarajamanohar monicarajamanohar commented Sep 17, 2018

Any luck updating the CRAN?

@timelyportfolio
Copy link
Owner

@timelyportfolio timelyportfolio commented Sep 17, 2018

@monicarajamanohar just submitted so we'll see if it gets approved

@timelyportfolio
Copy link
Owner

@timelyportfolio timelyportfolio commented Sep 18, 2018

@monicarajamanohar this was accepted last night on CRAN. Please let me know once you get a chance to test.

@monicarajamanohar
Copy link
Author

@monicarajamanohar monicarajamanohar commented Sep 19, 2018

I checked and it works beautifully!!! Thank you for giving such a quick resolution :D. I will close the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.