There were several solutions around, but none of them did what I really wanted: take some nice, working D3js
graph visualisation code and feed it with .dot
file instead of .json
file.
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/d3-dot-graph@1.0.0/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