Skip to content

Instantly share code, notes, and snippets.

@dividedmind
Created November 15, 2013 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dividedmind/7487701 to your computer and use it in GitHub Desktop.
Save dividedmind/7487701 to your computer and use it in GitHub Desktop.
sigi = sigma.instances[1];
var prefix = /.{7}/;
sigi.iterNodes(function (node) {
node.label = node.attr.kind + ": " + node.attr.name.replace(prefix, '');
});
WebFontConfig = {
google: { families: [ 'Lato::latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
var drawingProperties = {
edgeLabelThreshold: 1,
edgeLabelSizeRatio: 1,
defaultEdgeColor: "#a9a9a9",
defaultEdgeLabelColor: "#333333",
font: 'Lato',
edgeFont: 'Lato'
};
var kind_colors = {
environment: "#000000",
group: "#666666",
variable: "#1d1d1d",
resource: "#018798",
user: "#4a5960",
host: "#9D0D0D",
service: "#009380"
};
function kind_color(kind) {
return kind_colors[kind];
}
sigi.iterEdges(function (e) { e.color = undefined } );
sigi.iterNodes(function (e) { e.color = kind_color(e.attr.kind) } );
sigi.drawingProperties(drawingProperties);
console.log(drawingProperties);
console.log(kind_colors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment