I don't know whether it's a problem in networkD3 or in Shiny.
When first loading the page, no Sankey Network, the dateInput works. As soon as the Sankey Network (the simple one from the help example) is rendered, the dateInput stops working properly:
library(shiny)
library(networkD3)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
dateInput("date", "Date: "),
actionButton("showSankey", "Show Sankey")
),
mainPanel(
sankeyNetworkOutput("plotSankeyGraph")
)
)
)
server <- function(input, output) {
observeEvent(input$showSankey, {
output$plotSankeyGraph <- renderSankeyNetwork({
URL <- paste0('https://cdn.rawgit.com/christophergandrud/networkD3/',
'master/JSONdata/energy.json')
energy <- jsonlite::fromJSON(URL)
sankeyNetwork(Links = energy$links, Nodes = energy$nodes, Source = 'source',
Target = 'target', Value = 'value', NodeID = 'name',
units = 'TWh', fontSize = 12, nodeWidth = 30)
})
})
}
shinyApp(ui = ui, server = server)
Using networkD3 0.4 and Shiny 1.0.5 (R 3.4.1).
I don't know whether it's a problem in networkD3 or in Shiny.
When first loading the page, no Sankey Network, the dateInput works. As soon as the Sankey Network (the simple one from the help example) is rendered, the dateInput stops working properly:
Using networkD3 0.4 and Shiny 1.0.5 (R 3.4.1).