Skip to content

Commit 2d97d12

Browse files
patch to allow root label specification with csv_to_hier #114 and let rootLabel argument work again with sund2b()
1 parent 9f47439 commit 2d97d12

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: sunburstR
22
Type: Package
33
Title: Sunburst 'Htmlwidget'
4-
Version: 2.1.6
5-
Date: 2021-09-19
4+
Version: 2.1.7
5+
Date: 2022-06-12
66
Authors@R: c(
77
person(
88
"Mike", "Bostock"

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# sunburstR 2.1.7
2+
3+
* allow specification of root label in internal `csv_to_hier` converter function
4+
* fix bug where `rootLabel` argument for `sund2b` was not working ; (see [issue 114](https://github.com/timelyportfolio/sunburstR/issues/114))
5+
16
# sunburstR 2.1.6
27

38
* add labels for slices based on https://bl.ocks.org/vasturiano/12da9071095fbd4df434e60d52d2d58d

R/converters.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#' @keywords internal
2-
csv_to_hier <- function(csv, delim = "-") {
2+
csv_to_hier <- function(csv, delim = "-", rootLabel = "root") {
33
hier_col <- strsplit(as.character(csv[[1]]), delim)
44
# determine max length of all the paths to build column names
55
# issue 107
@@ -21,5 +21,5 @@ csv_to_hier <- function(csv, delim = "-") {
2121
df <- df[,-1]
2222
}
2323
df$size = csv[[2]]
24-
d3r::d3_nest(df, value_cols = "size")
24+
d3r::d3_nest(df, value_cols = "size", root = rootLabel)
2525
}

inst/htmlwidgets/sund2b.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ HTMLWidgets.widget({
7474
}
7575

7676
if(x.options.hasOwnProperty("rootLabel") && x.options.rootLabel !== null) {
77-
x.data.root.label = x.options.rootLabel;
77+
x.data.root.name = x.options.rootLabel;
7878
}
7979

8080
d3.select(el).datum(x.data)

0 commit comments

Comments
 (0)