Skip to content

zroger/xdot.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xdot.js

xdot.js parses GraphViz xdot formatted strings into Raphaël objects. This first version of xdot.py is a very close port of the lexer/parser code in xdot.py.

Generating xdot files

xdot is generated from dot files using one of the GraphViz layout commands. In this case, we'll just use the dot command.

> dot -Txdot -oexample.xdot example.dot

Usage

Include jQuery, Raphael and xdot.js. Create a new XDotParser object with your xdot formatted text, parse it, then draw it.

var graph = new XDotParser(text).parse();
graph.draw();

Or, you can get the xdot data via AJAX.

$.get('graph.xdot', function(text) {
  var graph = new XDotParser(text).parse();
  graph.draw();
});

Todo

  • Decouple the parsing from the drawing. Ideally, we could use any capable drawing library, not just Raphael.
  • Overall code cleanup. I'm not happy with how many variables are added to the global namespace.

About

xdot.js parses GraphViz xdot files into RaphaëlJS graphics.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published