From c6e742f97a065a452445702645ec06c1ea91ea07 Mon Sep 17 00:00:00 2001 From: Patrik Henningsson Date: Tue, 26 Jun 2018 10:04:21 +0200 Subject: [PATCH] Document new graph settings --- README.md | 3 +++ lib/api.js | 3 +++ lib/graph.js | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 88f86a84..2da84b0e 100644 --- a/README.md +++ b/README.md @@ -184,9 +184,12 @@ Property | Type | Default | Description `requireConfig` | String | null | RequireJS config for resolving aliased modules `webpackConfig` | String | null | Webpack config for resolving aliased modules `layout` | String | dot | Layout to use in the graph +`rankdir` | String | LR | Sets [direction](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rankdir) of the graph layout `fontName` | String | Arial | Font name to use in the graph `fontSize` | String | 14px | Font size to use in the graph `backgroundColor` | String | #000000 | Background color for the graph +`nodeShape` | String | box | A string specifying the [shape](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#k:shape) of a node in the graph +`nodeStyle` | String | rounded | A string specifying the [style](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#k:style) of a node in the graph `nodeColor` | String | #c6c5fe | Default node color to use in the graph `noDependencyColor` | String | #cfffac | Color to use for nodes with no dependencies `cyclicNodeColor` | String | #ff6c60 | Color to use for circular dependencies diff --git a/lib/api.js b/lib/api.js index 01d89d2e..b61c3ae6 100644 --- a/lib/api.js +++ b/lib/api.js @@ -12,11 +12,14 @@ const defaultConfig = { includeNpm: false, requireConfig: null, webpackConfig: null, + rankdir: 'LR', layout: 'dot', fontName: 'Arial', fontSize: '14px', backgroundColor: '#111111', nodeColor: '#c6c5fe', + nodeShape: 'box', + nodeStyle: 'rounded', noDependencyColor: '#cfffac', cyclicNodeColor: '#ff6c60', edgeColor: '#757575', diff --git a/lib/graph.js b/lib/graph.js index 51cff156..1e512570 100644 --- a/lib/graph.js +++ b/lib/graph.js @@ -49,7 +49,7 @@ function createGraphvizOptions(config) { G: Object.assign({ overlap: false, pad: 0.3, - rankdir: 'LR', + rankdir: config.rankdir, layout: config.layout, bgcolor: config.backgroundColor }, graphVizOptions.G), @@ -60,8 +60,8 @@ function createGraphvizOptions(config) { fontname: config.fontName, fontsize: config.fontSize, color: config.nodeColor, - shape: 'box', - style: 'rounded', + shape: config.nodeShape, + style: config.nodeStyle, height: 0, fontcolor: config.nodeColor }, graphVizOptions.N)