# Module to plot histogram using highcharter histoUI<-function(id){ ns<-NS(id) tagList( selectizeInput(ns("selreve"), "Select", choices = c("self","other"), selected=c("self")), highchartOutput(ns("histoplot")) ) } # Moduleserver #Server histoServer<-function(id, df, segment){ moduleServer(id, function(input, output, session){ output$histoplot<-renderHighchart({ summ.dat<- df |> filter(Cluster==segment) |> mutate( self=Self.Purchase1+Self.Purchase2+Self.Purchase3, other=Other.Purchase1+Other.Purchase2+Other.Purchase3 ) if(input$selreve=="self"){ revenue<-summ.dat$self } if(input$selreve=="other"){ revenue<-summ.dat$other } #create histogram hchart(revenue) |> hc_title(text = "Revenue Distribution") |> hc_xAxis(title = list(text = "Revenue")) |> hc_yAxis(title = list(text = "Count")) }) }) }