Skip to content

Commit

Permalink
[sankey] make the default nodeLabel "id" (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman authored Dec 24, 2023
1 parent be5cf02 commit 260726d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inst/sankey_network.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// !preview r2d3 data = jsonlite::toJSON(list(links = data.frame(source = c("A", "A"), target = c("B", "C"), value = c(10,5)), nodes = data.frame(id = c("A", "B", "C"), group = c("A", "B", "C")))), dependencies = "inst/lib/d3-sankey/d3-sankey.min.js", d3_version = 6, options = list(nodeLabel = "id", linkStrokeOpacity = 0.3, nodeLabelPadding = 6), container = "div", viewer = "internal"
// !preview r2d3 data = jsonlite::toJSON(list(links = data.frame(source = c("A", "A"), target = c("B", "C"), value = c(10,5)), nodes = data.frame(id = c("A", "B", "C"), group = c("A", "B", "C")))), dependencies = "inst/lib/d3-sankey/d3-sankey.min.js", d3_version = 6, options = list(linkStrokeOpacity = 0.3, nodeLabelPadding = 6), container = "div", viewer = "internal"

div.append("svg");
const tooltip_div = div.append("div");
Expand All @@ -14,7 +14,7 @@ const sankey = d3.sankey();
r2d3.onRender(function(data, div, width, height, options) {

const nodeId = options.nodeId ?? "id";
const nodeLabel = options.nodeLabel ?? "name";
const nodeLabel = options.nodeLabel ?? "id";
const nodeAlign = options.nodeAlign ?? "sankeyJustify";
const nodeWidth = options.nodeWidth ?? 24;
const nodePadding = options.nodePadding ?? 8;
Expand Down

0 comments on commit 260726d

Please sign in to comment.