Open
Description
As sunburst/treemap charts have their own click-events: plotly_sunburstclick / plotly_treemapclick it would be nice to support them in highlight
.
The following (plotly_click
) doesn't work as expected:
library(plotly)
library(crosstalk)
sunburstDF <- structure(list(labels = structure(c(1L, 3L, 4L, 2L, 7L, 6L, 5L,
7L, 6L, 5L, 7L, 6L, 5L), levels = c("Total", "mixed", "private",
"public", "commercial", "recreation", "residential"), class = "factor"),
values = c(1658, 353, 1120, 185, 108, 143, 102, 300, 320,
500, 37, 58, 90), parents = c(NA, "Total", "Total", "Total",
"Total - private", "Total - private", "Total - private",
"Total - public", "Total - public", "Total - public", "Total - mixed",
"Total - mixed", "Total - mixed"), ids = c("Total", "Total - private",
"Total - public", "Total - mixed", "Total - private - residential",
"Total - private - recreation", "Total - private - commercial",
"Total - public - residential", "Total - public - recreation",
"Total - public - commercial", "Total - mixed - residential",
"Total - mixed - recreation", "Total - mixed - commercial"
)), row.names = c(NA, -13L), class = "data.frame")
d <- highlight_key(sunburstDF, ~ids)
fig <- plot_ly(data = d, ids = ~ids, labels= ~labels, parents = ~parents, values= ~values, type='sunburst', branchvalues = 'total')
fig1 <- fig2 <- highlight(fig, on = "plotly_click", off = "plotly_doubleclick", dynamic = FALSE)
crosstalk::bscols(fig1, fig2)
Related: allow plotly_unhover as an off
event: #1864
Metadata
Metadata
Assignees
Labels
No labels