Sund2b legend wrapping
tykerx opened this issue · 2 comments
tykerx commented
timelyportfolio commented
@tykerx thanks for posting the issue and using sunburstR
.
Using CSS
A simple solution would be to apply some CSS
.
library(sunburstR)
# use a sample of the sequences csv data
sequences <- read.csv(
system.file("examples/visit-sequences.csv",package="sunburstR")
,header = FALSE
,stringsAsFactors = FALSE
)[1:200,]
# make the values bigger for demonstration
sequences$V2 <- sequences$V2 * 1000
# create a d2b sunburst
htmlwidgets::prependContent(
sund2b(sequences, elementId = "my-sunburst"), # add an id so css specificity will prefer,
htmltools::tags$style("#my-sunburst .d2b-sunburst-breadcrumb, #my-sunburst .d2b-sunburst-value {font-size: 8pt;}") # our id added below
)
Multiple Sunbursts with CSS
If you are using multiple d2b sunbursts in a chart and you don't want to use prependContent
on each, you could add style to all with something like this in rmarkdown
or shiny
.
tags$head(
tags$style(".html-widget .d2b-sunburst-breadcrumb, .html-widget .d2b-sunburst-value {font-size: 8pt;})
)
More Advanced
For ultimate control of the sunburst, I could add the functionality to control the breadcrumb as demonstrated in this example. This currently is not supported, but I can add if necessary.
timelyportfolio commented
@tykerx, going to close. Feel free to reopen if the solution does not work for you. Thanks!