Skip to content

Potential conflict with RHandsontable, moment.js #265

Description

@AdamElderfield

I am experiencing strange behaviour when launching a shiny application which has two dyGraphs. The data displayed on the legend does not appear on mouse hover over. My limited JS understanding is that there is a conflict between rhandsontable and dygrpahs with the moment JS library.

I believe this is happening only when I use quarterly data in a time object (XTS, TS) - this doesn't happen with yearly or monthly.

A reproduceable example is below:


library(shiny)
library(rhandsontable)
library(dygraphs)
library(DT)

#
ui <- fluidPage(

    # Application title
    titlePanel("Handsontable/Dygraphs issue"),


       
        mainPanel(
        # Quarterly data, issue
          dygraphOutput("dygraph_q"),
          rHandsontableOutput("table_q"),
          
          # Works
          dygraphOutput("dygraph_y"),
          rHandsontableOutput("table_y")
          
    )
    
    )



server <- function(input, output) {
    
    #####
    # Quarterly data issue!
    #####
    

    output$dygraph_q <- renderDygraph({
     
        
        dat <- data.frame(x=(seq.Date(ymd("2020-02-01"),length.out = 100, by = "quarter")),
                          
                          y= 1:100) 
        
        dat <- xts(dat$y,order.by = dat$x)
        
        
     dygraph(dat)
            
        
    })
    
    output$table_q <- renderRHandsontable( {        dat <- data.frame(x=seq.Date(ymd("2020-02-01"),length.out = 100, by = "quarter"),
                                                                     y= 1:100)
    
    
    
    rhandsontable(dat, width = 200, height = 200)
                                                 
                                                 })
    #####
    # Yearly data fine!
    #####
    
    output$dygraph_y <- renderDygraph({
        
        dat <- data.frame(x=(seq.Date(ymd("2020-02-01"),length.out = 100, by = "year")),
                          
                          y= 1:100) 
        
        dat <- xts(dat$y,order.by = dat$x)
        
        
        dygraph(dat)
        
        
    })
    
    output$table_y <- renderRHandsontable( {        dat <- data.frame(x=seq.Date(ymd("2020-02-01"),length.out = 100, by = "year"),
                                                                     y= 1:100)
    
    
    
    rhandsontable(dat, width = 200, height = 200)
    
    })
    
    
    
    
}

# Run the application 
shinyApp(ui = ui, server = server)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions