timelyportfolio/sunburstR

custom sund2bBreadcrumb outputs text in all upper case

missuse opened this issue · 1 comments

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!