Skip to content

Instantly share code, notes, and snippets.

@afrinc
Created April 21, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afrinc/7d62cc15f4168799dcf8d1908864344b to your computer and use it in GitHub Desktop.
Save afrinc/7d62cc15f4168799dcf8d1908864344b to your computer and use it in GitHub Desktop.
adding text inside the embedded circle
const count_text = g
.append("svg:text")
.attr("class", "countText")
.attr("r", 10)
.attr("dx", function(d) {
let X = outerNodebbox.x;
let WIDTH = outerNodebbox.width;
return X + (2.5 * WIDTH) / 3;
})
.attr("dy", function(d) {
let Y = outerNodebbox.y;
let HEIGHT = outerNodebbox.height;
return Y + (2 * HEIGHT) / 3;
})
.attr("dominant-baseline", "central")
.text(d => {
return d["connection_count"];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment