sund2b rootLabel malfunction when tooltip option used
dboko opened this issue · 2 comments
Hello,
Thanks for your work. I'm a beginner at this. I'm noticing that I can easily change the root label when not using the tooltip option. However, when I use the tooltip option I cannot alter the root label.
Thank you,
Denis
This is my code:
sund2b(sequences, breadcrumbs = sund2bBreadcrumb(
html = htmlwidgets::JS("
function(nodedata, size, percent) {
return '<span style="font-weight: bold;">' + nodedata.name + '' + ' '
}
")
) ,tooltip = sund2bTooltip(
html = htmlwidgets::JS("
function(nodedata) {
return '<span style="font-weight: regular;">' + nodedata.name + '' + ' '
}
")
), rootLabel="change")
@dboko very good question, and I can see how this could be confusing. Based on how d2b
works rootLabel
sets a property label
on the root node (see lines). If we override the tooltip or breadcrumb with a function, we'll need to add some logic to choose label
instead of name
for root.
sund2b(
sequences,
breadcrumbs = sund2bBreadcrumb(
html = htmlwidgets::JS(
"
function(nodedata, size, percent) {
return '<span style=\"font-weight: bold;\">' + (nodedata.name === 'root' ? nodedata.label : nodedata.name) + '' + ' '
}
"
)
),
tooltip = sund2bTooltip(
html = htmlwidgets::JS(
"
function(nodedata) {
return '<span style=\"font-weight: bold;\">' + (nodedata.name === 'root' ? nodedata.label : nodedata.name) + '' + ' '
}
"
)
)
,rootLabel = "change"
)
This is great, thank you very much!