updated readme.
This commit is contained in:
parent
d873eacbcc
commit
cf08847e69
1 changed files with 17 additions and 6 deletions
23
README.md
23
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# d3-dot-graph
|
# d3-dot-graph
|
||||||
|
|
||||||
This module provides [D3js](#d3js) compatible library to parse and load files in graphviz [.dot](#dot) (graph description language) format.
|
This module provides [D3js](d3js) compatible library to parse and load files in graphviz [.dot](dot) (graph description language) format.
|
||||||
|
|
||||||
## why?
|
## why?
|
||||||
While working on Java Platform Module System migration projects coming with Java 9 (as of August 2017), I am havily using jdeps which is generating DOT (.dot) files. These are usually visualized using dot tool of graphviz.
|
While working on Java Platform Module System migration projects coming with Java 9 (as of August 2017), I am havily using jdeps which is generating DOT (.dot) files. These are usually visualized using dot tool of graphviz.
|
||||||
|
|
@ -11,7 +11,10 @@ In most cases it is enough, but I wanted to have nicer d3js visualization and in
|
||||||
|
|
||||||
Usage is identical with well known ´d3.json([url], [callback])´ or ´d3.csv([url], [callback])´.
|
Usage is identical with well known ´d3.json([url], [callback])´ or ´d3.csv([url], [callback])´.
|
||||||
|
|
||||||
```js
|
```html
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/gmamaladze/d3-dot-graph@1.0.0/build/d3-dot-graph.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
d3.dot("/path/to/graph.dot", function(error, graph) {
|
d3.dot("/path/to/graph.dot", function(error, graph) {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
console.log(JSON.stringify(graph, null, true));
|
console.log(JSON.stringify(graph, null, true));
|
||||||
|
|
@ -20,19 +23,27 @@ d3.dot("/path/to/graph.dot", function(error, graph) {
|
||||||
// "links": [ {"source": "Myriel"}, {"target": "Napoleon"}]
|
// "links": [ {"source": "Myriel"}, {"target": "Napoleon"}]
|
||||||
//}
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
## parser
|
## parser
|
||||||
|
|
||||||
The parser was generated using [PEG.js](#pegjs). The grammer is taken from here [cpettitt/graphlib-dot](https://github.com/cpettitt/graphlib-dot). Thanks to Chris Pettitt.
|
The parser was generated using [PEG.js](pegjs). The grammer is taken from here [cpettitt/graphlib-dot](https://github.com/cpettitt/graphlib-dot). Thanks to Chris Pettitt.
|
||||||
|
|
||||||
You can also use parser independently from loader and converter.
|
You can also use parser independently from loader and converter.
|
||||||
|
|
||||||
# build
|
# build
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install #install dependencies and build
|
||||||
|
npm run build #generate parser, and rollup
|
||||||
|
|
||||||
|
rollup -c -w (rollup --config --watch) #very convenient rolls the whenever sources are changed
|
||||||
|
```
|
||||||
|
|
||||||
## notes
|
## notes
|
||||||
|
|
||||||
[#d3js]: https://www.d3js.org
|
[d3js]: https://www.d3js.org
|
||||||
[#dot]: https://en.wikipedia.org/wiki/DOT_(graph_description_language)
|
[dot]: https://en.wikipedia.org/wiki/DOT_(graph_description_language)
|
||||||
[#pegjs]: https://pegjs.org
|
[pegjs]: https://pegjs.org
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue