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

Potential conflict with dygraphs, moment.js #433

Open
AdamElderfield opened this issue Nov 24, 2023 · 0 comments
Open

Potential conflict with dygraphs, moment.js #433

AdamElderfield opened this issue Nov 24, 2023 · 0 comments

Comments

@AdamElderfield
Copy link

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.

Is there anything I can do to resolve this?

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)

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