我正在创建一个带有瀑布图的 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', line = list(color = '#93d500', width = 3))),totals = list(marker = list(color = '#93d500', line = list(color = '#93d500', width = 3))),connector = list(line = list(color= '#93d500'))) %>%
add_trace(measure = ~Amount.Lost, x = ~Award.Quarter, name = "Losses", textposition = "outside", y= ~Amount.Lost, text =~paste("$",round(Amount.Lost/1000000,1),"M; ",Num.Lost," Opps", sep=""),decreasing = list(marker = list(color = '#f37620', line = list(color = '#f37620', width = 2))), increasing = list(marker = list(color = '#f37620', line = list(color = '#f37620', width = 3))),totals = list(marker = list(color = '#f37620', line = list(color = '#f37620', width = 3))),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)