Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions R/sankeyNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#' @param fontFamily font family for the node text labels.
#' @param nodeWidth numeric width of each node.
#' @param nodePadding numeric essentially influences the width height.
#' @param nodeStrokeWidth numeric width of the stroke around nodes.
#' @param margin an integer or a named \code{list}/\code{vector} of integers
#' for the plot margins. If using a named \code{list}/\code{vector},
#' the positions \code{top}, \code{right}, \code{bottom}, \code{left}
Expand Down Expand Up @@ -74,8 +75,8 @@

sankeyNetwork <- function(Links, Nodes, Source, Target, Value,
NodeID, NodeGroup = NodeID, LinkGroup = NULL, units = "",
colourScale = JS("d3.scale.category20()"), fontSize = 7,
fontFamily = NULL, nodeWidth = 15, nodePadding = 10, margin = NULL,
colourScale = JS("d3.scale.category20()"), fontSize = 7, fontFamily = NULL,
nodeWidth = 15, nodePadding = 10, nodeStrokeWidth = 1, margin = NULL,
height = NULL, width = NULL, iterations = 32, sinksRight = TRUE)
{
# Check if data is zero indexed
Expand Down Expand Up @@ -131,8 +132,8 @@ sankeyNetwork <- function(Links, Nodes, Source, Target, Value,
# create options
options = list(NodeID = NodeID, NodeGroup = NodeGroup, LinkGroup = LinkGroup,
colourScale = colourScale, fontSize = fontSize, fontFamily = fontFamily,
nodeWidth = nodeWidth, nodePadding = nodePadding, units = units,
margin = margin, iterations = iterations, sinksRight = sinksRight)
nodeWidth = nodeWidth, nodePadding = nodePadding, nodeStrokeWidth = nodeStrokeWidth,
units = units, margin = margin, iterations = iterations, sinksRight = sinksRight)

# create widget
htmlwidgets::createWidget(name = "sankeyNetwork", x = list(links = LinksDF,
Expand Down
1 change: 1 addition & 0 deletions inst/htmlwidgets/sankeyNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ HTMLWidgets.widget({
.style("fill", function(d) {
return d.color = color_node(d); })
.style("stroke", function(d) { return d3.rgb(d.color).darker(2); })
.style("stroke-width", options.nodeStrokeWidth)
.style("opacity", 0.9)
.style("cursor", "move")
.append("title")
Expand Down
6 changes: 4 additions & 2 deletions man/sankeyNetwork.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.