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

custom sund2bBreadcrumb outputs text in all upper case #119

Open
missuse opened this issue Mar 14, 2024 · 1 comment
Open

custom sund2bBreadcrumb outputs text in all upper case #119

missuse opened this issue Mar 14, 2024 · 1 comment

Comments

@missuse
Copy link

missuse commented Mar 14, 2024

Hi and thanks for developing a great package!

I am trying to customize the breadcrumbs within sunburstR::sund2b and it seems the text is always in upper case. Could you please show an example how to change this behavior:

library(sunburstR)

df <- data.frame(seq = c("A","B","C"),
                            size = c(13.4, 9.22, 7.111))

js_bread <- "function(nodedata, size, percent) {
                    var roundedSize = Math.round(size * 100) / 100;
                    var roundedPercent = Math.round(percent * 100 * 10) / 10 ;
    
                    var sizeText = roundedSize + ' h';

                    var breadcrumb = '<div style=\"text-align: center; font-weight: bold; \">' + nodedata.name + '</div>';
                    breadcrumb += '<div style=\"display: flex; justify-content: space-between;\">';
                    breadcrumb += '<div style=\"flex-grow: 1; font-size: 14px;\">' + sizeText + '</div>';
                    breadcrumb += '<div style=\"text-align: right; font-size: 14px; \">' + roundedPercent + '%' + '</div>';
                    breadcrumb += '</div>';
      
                   return breadcrumb;
              }
            "
sunburstR::sund2b(
  df,
  showLabels = TRUE,
  breadcrumbs = sunburstR::sund2bBreadcrumb(
    html = htmlwidgets::JS(js_bread))
  )

output is
image
and "H" is in uppercase.

Thank you!

@hammerPC
Copy link

hammerPC commented Mar 14, 2024 via email

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

No branches or pull requests

2 participants