I am using plotly in R. What I want to do is to show a histogram and boxplot of the rent(v1030) of certain location. The plot can be changed by the the conditions input by several drop down menu in the crosstalk filters. (i.e.whether having Toilet, whether having Lift) When the drop down menu is showed, it include an option "(All)" at the top of the drop down menu. Keeping the (All) option to keep the entire database looks fine to me, but evreytime after I select a specific filter in the drop down menu (e.g. "Yes" in Toilet), when I click back to the (All) option in the drop down menu, the plot does not change (i.e. keep on filtered by "Yes" in Toilet). The plot changes normally when I swap through "Yes" and "No" in the drop down menu. The problem just happens when I select (All). Is there any solution for the problem? My code is as follows:
'''
library(plotly)
library(crosstalk)
library(dbplyr)
dataset$v1017 <- factor(dataset$v1017,levels = c(0,1),labels = c("No","Yes"))
dataset$v1018 <- factor(dataset$v1018,levels = c(0,1),labels = c("No","Yes"))
shareD<-SharedData$new(dataset)
p1<-shareD %>% plot_ly(x=~v1030)%>%add_histogram()%>%
layout(xaxis = list(dtick=1000,title = "Rent $"),yaxis =
list(title="Frequency",fixedrange=TRUE))%>%config(displayModeBar = F)
p2<-shareD%>% plot_ly(y=~v1030,type="box",boxpoints=FALSE)%>%
layout(yaxis = list(dtick=1000,title = "Rent $"))%>%config(displayModeBar = F)
rentcaculator<-bscols(widths=c(3,NA),list(
filter_select(id = "lift", label = "Lift", multiple = FALSE,sharedData = shareSDU, group
= ~v1018),
filter_select(id = "toilet", label = "Toilet", multiple = FALSE,sharedData = shareSDU,
group = ~v1017),
p1,p2)
rentcaculator
'''