Open rsangole opened 3 years ago
I'm attempting to replace a customized plotly barchart with one using billboarder.
plotly
billboarder
The customizations I am looking for:
cat_2
Here's a repress for my Plotly chart:
library(plotly) library(dplyr) dt <- tibble( cat_1 = c("apple", "banana", "apple", "banana"), cat_2 = c("store 1", "store 1", "store 2", "store 2"), custom_hover_text = c("Hover 1", "Hover 1", "Hover 2", "Hover 2"), some_value = c(4, 5, 2, 3) ) dt <- dt %>% dplyr::group_by(cat_2) %>% dplyr::mutate(totals_for_the_label = sum(some_value)) %>% dplyr::ungroup() dt plotly::plot_ly(data = dt) %>% plotly::add_bars( x = ~ cat_2, y = ~ some_value, color = ~ cat_1, colors = c(`apple` = "#118ab2", `banana` = "#ffd166"), hoverinfo = "text", hovertext = ~ glue::glue("{custom_hover_text} : {cat_2} is {some_value}") ) %>% plotly::layout(barmode = "stack") %>% plotly::add_text( text = ~ totals_for_the_label, x = ~ cat_2, y = ~ totals_for_the_label, textposition = "top middle", cliponaxis = FALSE, inherit = FALSE, hoverinfo = "none", showlegend = FALSE )
Is this possible with billboarder ?
I'm attempting to replace a customized
plotly
barchart with one usingbillboarder
.The customizations I am looking for:
cat_2
Here's a repress for my Plotly chart:
Is this possible with
billboarder
?