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

Possible bug with dateRangeInput when plotting sankeyNetworks from networkD3 package #2349

Closed
leungi opened this issue Mar 6, 2019 · 1 comment

Comments

@leungi
Copy link

leungi commented Mar 6, 2019

Bringing up the issue by @nkk36 from #1959.

Issues:

reprex from original post.

# Setup =================================
# Load Packages
library(networkD3)
library(shiny)
library(shinydashboard)


# UI =================================
ui = dashboardPage(
  dashboardHeader(title = "Title"),
  # UI Sidebar =================================
  dashboardSidebar(
    sidebarMenu(
      dateRangeInput(inputId = "dates",
                     label = "Select time period:",
                     start = "2000-01-01",
                     end = "2018-02-01",
                     min = "2000-01-01",
                     max = "2018-02-01",
                     format = "mm-yyyy")
    )
  ),
  # UI Body =================================
  dashboardBody(
    fluidRow(
      box(sankeyNetworkOutput(outputId = "sankey_diagram"), 
          width = 12)
            )
    )
)

# Server =================================
server = function(input, output, session){
  # Render sankey diagram =================================
  output$sankey_diagram = renderSankeyNetwork({
    
    
    t1 = data.frame(source = c(0,0,
                              1,1),
                   target = c(2,3,
                              2,3),
                   value = c(100, 25,
                             10, 20))
    
    t2 = data.frame(id = c(0,1,2,3),
                      name = c("Group 1", "Group 2", 
                               "Group 3", "Group 4"))
    
    s = sankeyNetwork(Links = t1,
                      Nodes = t2,
                      Source = "source",
                      Target = "target",
                      Value = "value",
                      NodeID = "name",
                      NodeGroup = "name",
                      fontSize = 12,
                      nodeWidth = 30,
                      iterations = 0,
                      colourScale = JS("d3.scaleOrdinal(d3.schemeCategory10);"))
    return(s)
    
  }) 
}
# Run Shiny App =================================
shinyApp(ui, server)
@alandipert alandipert self-assigned this Mar 21, 2019
@alandipert alandipert added this to the 1.2.1 milestone Mar 21, 2019
alandipert added a commit that referenced this issue Mar 21, 2019
* bootstrap-datepicker assumed the presence of only one 'body' tag on the page
(document.body), and relied on the jQuery selector string 'body' to find
it and use it as a container for the picker popup box
* SVGs generated by networkD3 (and likely SVGs from elsewhere) break
that assumption as they may contain multiple 'body' tags, which caused
the picker popup box to be mismanaged and invisible
* The fix was to make the body selector more specific: 'body:first'
did the job.
alandipert added a commit that referenced this issue Mar 21, 2019
* bootstrap-datepicker assumed the presence of only one 'body' tag on the page
(document.body), and relied on the jQuery selector string 'body' to find
it and use it as a container for the picker popup box
* SVGs generated by networkD3 (and likely SVGs from elsewhere) break
that assumption as they may contain multiple 'body' tags, which caused
the picker popup box to be mismanaged and invisible
* The fix was to make the body selector more specific: 'body:first'
did the job.
alandipert added a commit that referenced this issue Mar 21, 2019
* bootstrap-datepicker assumed the presence of only one 'body' tag on the page
(document.body), and relied on the jQuery selector string 'body' to find
it and use it as a container for the picker popup box
* SVGs generated by networkD3 (and likely SVGs from elsewhere) break
that assumption as they may contain multiple 'body' tags, which caused
the picker popup box to be mismanaged and invisible
* The fix was to make the body selector more specific: 'body:first'
did the job.
alandipert added a commit that referenced this issue Mar 21, 2019
* bootstrap-datepicker assumed the presence of only one 'body' tag on the page
(document.body), and relied on the jQuery selector string 'body' to find
it and use it as a container for the picker popup box
* SVGs generated by networkD3 (and likely SVGs from elsewhere) break
that assumption as they may contain multiple 'body' tags, which caused
the picker popup box to be mismanaged and invisible
* The fix was to make the body selector more specific: 'body:first'
did the job.
alandipert added a commit that referenced this issue Mar 22, 2019
* bootstrap-datepicker assumed the presence of only one 'body' tag on the page
(document.body), and relied on the jQuery selector string 'body' to find
it and use it as a container for the picker popup box
* SVGs generated by networkD3 break that assumption as they may contain
multiple 'body' tags, which caused the picker popup box to be mismanaged and
invisible
* The fix was to make the body selector more specific: 'body:first'
did the job.
alandipert added a commit that referenced this issue Mar 22, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix in all cases was to make the body selector more specific:
'body:first' does the job.
@alandipert alandipert modified the milestones: 1.2.1, 1.3 Mar 22, 2019
alandipert added a commit that referenced this issue Mar 22, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
alandipert added a commit that referenced this issue Mar 27, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
alandipert added a commit that referenced this issue Mar 27, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
alandipert added a commit that referenced this issue Mar 27, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
alandipert added a commit that referenced this issue Mar 27, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
alandipert added a commit that referenced this issue Mar 27, 2019
* All of these were caused by the presence of multiple body tags on the
page, which happened because networkD3's sankey plot generates SVGs
containing body tags via SVG's foreignObject tag
* In various places, the 'body' jQuery selector string is used under the
assumption there is only one 'body' tag on the page. The presence of
multiple 'body' tags breaks reliant code in strange ways.
* The fix was to use document.body or 'body:first' instead of 'body'.
schloerke added a commit that referenced this issue Mar 27, 2019
* rc-v1.3.0:
  Remove reactlog from Remotes
  Fix #2349, #2329, #1817: bugs triggered by networkD3 sankey plot
  Improve bootstrap-datepicker update tools, add docs
  Add 'Fix datepicker DST bug' as patch
  Improve bootstrap-datepicker update script
  Re-import bootstrap-datepicker 1.6.4
  Remove httpuv and reactlog from remotes
  Restore intuitive bookmarking behavior (#2360)
@wch wch closed this as completed in 908d635 Apr 8, 2019
@leungi
Copy link
Author

leungi commented Apr 8, 2019

Thanks @alandipert and the Shiny team! 👍

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

No branches or pull requests

2 participants