Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shinytree and timevis bug? #38

Open
ghost opened this issue Sep 27, 2018 · 1 comment
Open

shinytree and timevis bug? #38

ghost opened this issue Sep 27, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 27, 2018

Hi!

If I dont include the timevisoutput, the shinytree will apear, when I added it doesnt show

Anyone know how to solve this? 



`library(shiny)
library(shinythemes)

groups <- data.frame(
  id = c("BOP", "probleem oplossend denken", "Netwerken 1"),
  content = c("BOP", "probleem oplossend denken", "Netwerken 1")
)

dataGroups <- data.frame(
  id = 1:9,
  content = c("Opdracht", "Opdracht",
              "Opdracht", "Opdracht", "Opdracht",
              "Opdracht", "Opdracht", "Opdracht", "Opdracht"),
  start = c("2018-05-01 07:30:00", "2018-05-01 14:00:00",
            "2018-05-01 06:00:00", "2018-05-01 14:00:00", "2018-05-01 08:00:00",
            "2018-05-01 08:00:00", "2018-05-01 08:30:00", "2018-05-01 14:00:00",
            "2018-05-01 16:00:00"
  ),
  end   = c("2018-05-01 12:00:00", "2018-05-01 20:00:00",
            "2018-05-01 12:00:00", "2018-05-01 22:00:00", "2018-05-01 10:00:00",
            "2018-05-01 08:30:00", "2018-05-01 12:00:00", "2018-05-01 16:00:00",
            "2018-05-01 20:00:00"
  ),
  group = c(rep("BOP", 2), rep("probleem oplossend denken", 3), rep("Netwerken 1", 4)),
  type = c(rep("range", 9))
)


data <- data.frame(
  id      = 1:4,
  content = c("Item one", "Item two",
              "Ranged item", "Item four"),
  start   = c("2016-01-10", "2016-01-11",
              "2016-01-20", "2016-02-14 15:00:00"),
  end     = c(NA, NA, "2016-02-04", NA)
)


server <- function(input, output, session) {
  output$timeline1 <- renderTimevis({
    timevis(data)
  })
  
  output$timeline2 <- renderTimevis({
    timevis(data = dataGroups, groups = data.frame( id = input$checkGroup, content= input$checkGroup), options = list(editable = TRUE))
  })
  
  output$tree <- renderTree({
    structure(
      list(
        'Fase 1' = structure(
          list(
            'OOP'=structure('',stid=1,stclass='study'), 
            'web1'=structure('',stid=2,stclass='study')
          ),
          stid=1,
          stopened=TRUE,
          stclass='project'
        ), 
        'Fase 2' = structure(
          list(
            'web2'=structure('',stid=3,stclass='study'), 
            'OOO'=structure('',stid=4,stclass='study')
          ),
          stid=2,
          stopened=TRUE,
          stclass='project'
        ), 
        'Fase 3' = structure(
          list(
            'pvm'=structure('',stid=3,stclass='study'), 
            'mobiele'=structure('',stid=4,stclass='study')
          ),
          stid=2,
          stopened=TRUE,
          stclass='project'
        )
      ),
      stopened=TRUE
    )
  })
}

ui <- fluidPage(theme=shinytheme("cerulean"),
                
                titlePanel("Use an existing theme"),
                
                sidebarLayout(
                  
                  sidebarPanel(
                    h3("Note the button is black. This is different from the previous app."),
                    actionButton("button", "A button")
                  ), 
                  
                  mainPanel(
                    tabsetPanel(
                      tabPanel("Plot"), 
                      tabPanel("Summary"), 
                      tabPanel("Table")
                    ),
                   
                    
                   
                    
                    fluidRow(
                     
                      column(3,
                             shinyTree("tree", checkbox = TRUE,theme="proton")),
                      column(3,
                             checkboxGroupInput("checkGroup", label = h3("Checkbox group"), 
                                                choices = list("Netwerken 1" = "Netwerken 1", "Probleem oplossend denken" = "Probleem Oplossend denken", "BOP" = "BOP"),
                                                selected = "Netwerken 1"))
                      
                       
                    ),
                    fluidRow(
                      
                      column(12,
                             textInput("text", h3("Text input"), 
                                       value = "Enter text..."))
                      
                      
                    ),
                    fluidRow(
                      
                      column(12,
                             textInput("text", h3("Text input"), 
                                       value = "Enter text..."))
                      
                      
                    ),
                    fluidRow(
                      
                      column(12,
                             timevisOutput("timeline1"))
                      
                     
                    ),
                    fluidRow(
                      
                      column(12,
                             timevisOutput("timeline2"))
                      
                      
                    )
                    
                  
                  )
                )
)

shinyApp(ui = ui, server = server)



Thanks in advance,
Calvin
@trafficonese
Copy link
Contributor

trafficonese commented Mar 1, 2019

The problem is somewhere in the second renderTimevis. If you remove it completely, everything renders correctly.

And more specific, if you remove the groups argument of the second timevis it is also working fine.
I am not very familiar with timevis, but I think theres a problem with your group argument, as it doesnt really show anything if you include it. If you remove it, I see "stuff" in that timeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant