1

I'm trying to include a senkey diagram (networkD3) and a sunburst diagram (sunburstR) into a Shiny app, but I find it did not work when I put them together. I don't get any errors however only the Sankey diagram displayed. Does anyone had the same experience?

I would really appreciate any help you can give.

Here is the R code:

library(shiny)
library(shinydashboard)
library(lubridate)
library(dplyr)
library(tidyr)
library("sunburstR")
library("D3partitionR")
library("networkD3")
library("visNetwork")

ui.R

ui <- fluidPage(
tabItem(tabName = "Sunburst",
        fluidPage(
          fluidRow(
            sunburstOutput("sunburst")
          )
        ),

        tabItem(tabName = "Sankey",
                fluidPage(
                  fluidRow(
                    sankeyNetworkOutput("sankey")
                  )
                )
            )
      )
)

server.R

server <- function(input, output, session) {
    output$sunburst <- renderSunburst({
    add_shiny(sunburst(sequence))

    })


    output$sankey <- renderSankeyNetwork({
    invalidateLater(100, session)
    sankeyNetwork(Links = Links, Nodes = Nodes,
                 Source = "Source2", Target = "Target2",
                 Value = "Value", NodeID = "name",
                 colourScale = JS("d3.scaleOrdinal(d3.schemeCategory20);")
                 )
  })
 }
Tonio Liebrand
  • 17,189
  • 4
  • 39
  • 59
Abdeljalil
  • 11
  • 1
  • 3
  • 2
    pls provide a fully reproducible example, incl. `Links`, `Nodes` etc. – Tonio Liebrand Apr 24 '17 at 07:36
  • The cause of the problem is that networkD3 has been updated to D3v4 and sunburstR is still using D3v3. I don't know of anyway to work around it on the user side. Actually, the only solution I can think of that you can currently do is downgrade networkD3 to a version <0.3, which is when we upgraded it to D3v4. – CJ Yetman Apr 24 '17 at 08:24

1 Answers1

1

The currently available, v1.0.0 version of sunburstR (published 2017-06-13) uses D3v4 and should not conflict with networkD3. Try updating your packages.

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56