微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

你能用 Plotly 聚合瀑布图中的数据吗?

如何解决你能用 Plotly 聚合瀑布图中的数据吗?

我正在创建一个带有瀑布图的 R flexdashboard,其中显示了一段时间内的销售额。有一个 filter_select(串扰)允许您一次选择一组。我想启用多选并在选择中汇总赢得的金额,而不是在图表上显示两个单独的系列。有谁知道这是否可能?

waterfall_sd <- SharedData$new(won.loss.waterfall.data,group="shared data 2")
filter_select("sectorWF.filter","Select Segment",waterfall_sd,~Segment,multiple = TRUE)

```

Row 
-------------------------------------

### Year to Date Summary {data-height=550}

```{r echo = FALSE}

plot_ly(waterfall_sd,type = "waterfall") %>%
                             add_trace(measure = ~Amount.Won,x = ~Award.Quarter,name = "Wins",textposition = "outside",y= ~Amount.Won,text =~paste("$",round(Amount.Won/1000000,1),"M; ",Num.Won," Opps",sep=""),decreasing = list(marker = list(color = '#93d500',line = list(color = '#93d500',width = 2))),increasing = list(marker = list(color = '#93d500',width = 3))),totals = list(marker = list(color = '#93d500',connector = list(line = list(color= '#93d500'))) %>% 
    add_trace(measure = ~Amount.Lost,name = "Losses",y= ~Amount.Lost,round(Amount.Lost/1000000,Num.Lost,decreasing = list(marker = list(color =  '#f37620',line = list(color =  '#f37620',increasing = list(marker = list(color =  '#f37620',totals = list(marker = list(color =  '#f37620',connector = list(line = list(color=  '#f37620'))) %>%
  layout(title = "2020 Wins and Losses",xaxis = list(title = "Quarter"),yaxis = list(title = ""),autosize = FALSE,showlegend = TRUE,width = 1625,height = 450)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。