The question asks for a possibility to visualise .dot
files einther in javascript
or D3js
. I think the solution from the highest rated answer will work for most of you.
I was unhappy because of these 3 reasons:
- It involves libraries like
lowdash
, dagre
and graphlib
additionally to D3js
and is heavyweight.
- Parser output is not a
D3js
"friedly" data-structure.
- Usage (API) in not D3js style.
That's why I created an adapter which will basically allow you to use .dot
files with any of thousands of D3js
samples by changing just one statement. If you have some D3js
visualisation working on following data-structure:
{
"nodes": [ {"id": "Myriel"}, {"id": "Napoleon"}],
"links": [ {"source": "Myriel"}, {"target": "Napoleon"}]
}
Just include following script and call d3.dot
:
<script src="https://cdn.jsdelivr.net/gh/gmamaladze/[email protected]/build/d3-dot-graph.min.js"></script>
<script>
d3.dot(url, function(graph) {
...
});
</script>
instead of:
d3.json(url, function(graph) {...});
GitHub repository with code and examples