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

Suggested Future Enhancements and Improvements #3

Open
3 tasks
SchmidtPaul opened this issue Aug 3, 2023 · 0 comments
Open
3 tasks

Suggested Future Enhancements and Improvements #3

SchmidtPaul opened this issue Aug 3, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@SchmidtPaul
Copy link
Owner

SchmidtPaul commented Aug 3, 2023

List of enhancements

  • Enhancement 1: Increasing the fontSize should also affect the xAxisDomain
  • Enhancement 2: Enable linebreaks in NodeID and xAxisDomain
  • Enhancement 3: Implement sinksRight = TRUE from networkD3::sankeyNetwork()

Reprex for enhancements

Enhancement 1

links <- data.frame(
  source = c(0, 0, 0, 1, 2),
  target = c(1, 2, 3, 4, 4)
)

sankeyD3plus::sankeyNetwork(
  Links = links,
  Source = "source",
  Target = "target", 
  fontSize = 30,
  nodePadding = 30,
  xAxisDomain = c("One", "Two", "Three")
)

Created on 2023-08-03 with reprex v2.0.2

Enhancement 2

links <- data.frame(
  source = c(0, 0, 1, 2),
  target = c(1, 2, 3, 3),
  value = c(10, 20, 10, 20)
)

nodes <- data.frame(
  label = c("I am using \n in this string",
            "I am using \r in this string",
            "I am using <br> in this string",
            "I am using
            in this string")
)

sankeyD3plus::sankeyNetwork(
  Links = links,
  Nodes = nodes,
  Source = "source",
  Target = "target",
  Value  = "value",
  NodeID = "label",
  xAxisDomain = c("Hello\nWorld", "Hello
                  World", "Hello<br>World")
)

Created on 2023-08-03 with reprex v2.0.2

Enhancement 3

URL <- paste0(
  "https://cdn.rawgit.com/christophergandrud/networkD3/",
  "master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)
networkD3::sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
                         Target = "target", Value = "value", NodeID = "name",
                         units = "TWh", fontSize = 12, nodeWidth = 30,
                         sinksRight = TRUE)

sankeyD3plus::sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
              Target = "target", Value = "value", NodeID = "name",
              units = "TWh", fontSize = 12, nodeWidth = 30,
              NodeGroup = "name")

Created on 2023-08-03 with reprex v2.0.2

@SchmidtPaul SchmidtPaul added enhancement New feature or request help wanted Extra attention is needed labels Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant