Skip to content

Instantly share code, notes, and snippets.

@Reflic
Created July 31, 2017 19:05
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 Reflic/733b0feb822cc0dbac5efd4f5656ca64 to your computer and use it in GitHub Desktop.
Save Reflic/733b0feb822cc0dbac5efd4f5656ca64 to your computer and use it in GitHub Desktop.
bubble(root);
const node = svg.selectAll('.node').data(root.children)
.enter().append('g').attr('class', 'node')
.attr('transform', function (d: any) {
return 'translate(' + d.x + ',' + d.y + ')';
});
node.append('title').text(function (d: any) {
return d.data.shortName;
});
node.append('circle').attr('r', function (d: any) {
return d.r;
}).style('fill', function (d: any) {
if (d.data.value === 'GOOD') {
return '#5CB85C';
} else if (d.data.value === 'NORMAL') {
return '#F0AD4E';
} else if (d.data.value === 'BAD') {
return '#D9534F';
} else {
return '#999';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment