Giter VIP home page Giter VIP logo

Comments (1)

benjaminleroy avatar benjaminleroy commented on August 11, 2024 1

If you're just doing filtering you can do something like the following:

library(plotly)
library(crosstalk)

df <- data.frame(x = rnorm(100),
               y = rnorm(100),
               class = factor(rep(1:5, each = 20)),
               peeps = rep(c(
                 "bob","joe","jane"
               ),length.out = 100),
               grouping_first = factor(rep(1:2, each = 50)),
               grouping_second = factor(rep(1:2, length.out = 50)))

theme_set(theme_minimal())

sd <- SharedData$new(df, group = "individual")

c1 <- filter_checkbox(id = "group1",sharedData = sd,group = ~grouping_first,
              label = "random dimension 1")
c2 <- filter_checkbox(id = "group2",sharedData = sd,group = ~grouping_second,
              label = "random dimension 2")

g1 <- sd %>% ggplot(aes(x =x ,y =y, color = class, text = peeps)) + 
geom_point() + labs(title = "Everyone")

i1 <- ggplotly(g1, tooltip = "text") %>%
highlight(on = "plotly_click",off = "plotly_doubleclick") 

bscols(widths = c(3,9),
     list(c1,c2), i1)

@cpsievert et al. related to this problem, it seems like there is an issue between having SharedData$new include a specified key. For example. just updating the above code to group by peep using

sd <- SharedData$new(df,key = ~peeps,
                     group = "individual")

makes the filtering fail (but the key=~peeps grouping works).

@kaylafrisoli

from crosstalk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.