Giter Site home page Giter Site logo

gmamaladze / d3-dot-graph Goto Github PK

View Code? Open in Web Editor NEW
37.0 8.0 7.0 117 KB

This module provides D3js compatible library to parse and load files in graphviz DOT (.dot) (graph description language) format.

License: MIT License

HTML 69.47% JavaScript 30.53%
d3js d3v4 dot graph-description-language graphviz d3 java9-jigsaw

d3-dot-graph's Introduction

d3-dot-graph

This module provides D3js compatible library to parse and load files in graphviz DOT (.dot) (graph description language) format.

why?

While working on Java Platform Module System migration projects coming with Java 9 (as of August 2017), I am heavily using jdeps which is generating DOT (.dot) files. These are usually visualised using dot tool of graphviz.

In most cases it is enough, but I wanted to have nicer D3js visualisation and interaction.

example

See sample summary.dot file generated by jdeps visualised using D3js here: index.html

Inspired by Mike Bostock's Mobile Patent Suits

usage

d3.dot(url, callback);

Usage is identical with well known d3.json([url], [callback]) or d3.csv([url], [callback]).

<script src="https://cdn.jsdelivr.net/gh/gmamaladze/[email protected]/build/d3-dot-graph.min.js"></script>
<script>

d3.dot("/path/to/graph.dot", function(error, graph) {
  if (error) throw error;
  console.log(JSON.stringify(graph, null, true));
  //{
  //  "nodes": [ {"id": "Myriel"}, {"id": "Napoleon"}],
  //  "links": [ {"source": "Myriel"}, {"target": "Napoleon"}]
  //}  
});

</script>

parser

The parser was generated using PEG.js. The grammer is taken from here cpettitt/graphlib-dot. Thanks to Chris Pettitt.

You can also use parser independently from loader and converter.

build

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

d3-dot-graph's People

Contributors

gmamaladze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d3-dot-graph's Issues

Can't get example to work

Hi, apologies if this is a silly issue - I can load the example from your repo in my browser (Firefox) no issue, but when I try to run the example on my own - for example on jsfiddle.net - it won't work - the svg element appears to just be empty. Here's the jsfiddle I tried:

https://jsfiddle.net/mairin/at1hem5v/5/

Any ideas on what I'm doing wrong?

Cannot read property 'links' of null

When trying to run the example, nothing is displayed and in the console the error "Uncaught TypeError: Cannot read property 'links' of null" is thrown. Additionally the parameter "graph" is null instead of the graph.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.