fbreitwieser / sankeyD3

D3 Sankey Network Graphs from R
67 stars 27 forks source link

Sankey network does not render #8

Closed oli666 closed 6 years ago

oli666 commented 7 years ago

Good morning,

I am hitting a wall with the following data structure:

structure(list(my_nodes = structure(list(my_name = c("0 AEP7 Brazil Prod", 
"1 eldmppbcc01", "2 poamppbcc01", "3 ESCR_Brazil_Portuguese", 
"4 ProSupport_Brazil", "5 AOS_Brazil"), ID = 0:5, group = c("0 ", 
"1 ", "2 ", "3 ", "4 ", "5 ")), class = "data.frame", .Names = c("my_name", 
"ID", "group"), row.names = c(NA, -6L)), my_links = structure(list(
    key = c("0_1", "0_2", "1_3", "1_4", "1_5", "2_3", "2_4", 
    "2_5", "3_4", "4_3", "4_5", "5_3", "5_4"), source = c(0L, 
    0L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 4L, 4L, 5L, 5L), target = c(1L, 
    2L, 3L, 4L, 5L, 3L, 4L, 5L, 4L, 3L, 5L, 3L, 4L), total = c(1894L, 
    1982L, 1499L, 203L, 192L, 1571L, 217L, 194L, 3L, 2L, 2L, 
    3L, 1L)), class = "data.frame", row.names = c(NA, -13L), .Names = c("key", 
"source", "target", "total"))), .Names = c("my_nodes", "my_links"
))

I use the following to create a sankey:

sankeyNetwork(Links = my_data$my_links, Nodes = my_data$my_nodes, Source = "source",
             Target = "target", Value = "total", NodeID = "my_name",
             units = "calls", fontSize = 2, nodeWidth = 10, nodePadding = 3)

The result look as follows: Broken Sankey

I can get the examples to work without an issue, hence, I suspect the data itself having the issue. Saying that, I get the Sankey rendered quite fine using the networkD3_0.4 package. Anything specific I have to pay attention to regarding the data input for the sankeyD3 package as compared to networkD3? Thanks, Oli

fbreitwieser commented 6 years ago

Sorry for the late answer, should be working now!