Skip to content

Commit

Permalink
Addressing issue dagrejs#150 - cluster styling; updated demo
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneymiller2010 committed May 14, 2015
1 parent 952f467 commit 3488d7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demo/clusters.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ <h1>Dagre D3 Demo: Clusters</h1>
g.setNode('e', {label: 'E'});
g.setNode('f', {label: 'F'});
g.setNode('g', {label: 'G'});
g.setNode('group', {label: 'Group', clusterLabelPos: 'top'});
g.setNode('top_group', {label: 'Top Group', clusterLabelPos: 'bottom'});
g.setNode('bottom_group', {label: 'Bottom Group'});
g.setNode('group', {label: 'Group', clusterLabelPos: 'top', style: 'fill: #d3d7e8'});
g.setNode('top_group', {label: 'Top Group', clusterLabelPos: 'bottom', style: 'fill: #ffd47f'});
g.setNode('bottom_group', {label: 'Bottom Group', style: 'fill: #5f9488'});

// Set the parents to define which nodes belong to which cluster
g.setParent('top_group', 'group');
Expand Down
6 changes: 6 additions & 0 deletions lib/create-clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ function createClusters(selection, g) {
labelGroup = thisGroup.append("g").attr("class", "label");
addLabel(labelGroup, node, node.clusterLabelPos);
});

svgClusters.selectAll("rect").each(function(c) {
var node = g.node(c);
var domCluster = d3.select(this);
util.applyStyle(domCluster, node.style);
});
}

0 comments on commit 3488d7e

Please sign in to comment.