Overview
Django data visualization with graphviz.
The django_graphviz django project provides 2 applications: - graphviz: the main component, embeddable in any project
- testapp: a sample application
ExampleThe models of the testapp application:
A typical diagram that may be generated:
How to ?- add the graphviz application to your django project
- set the GRAPHVIZ_DOT_CMD setting with the absolute path of the 'dot' command
- add a line like (r'^graphviz/', include('graphviz.urls')), in the main urls.py file
- add some methods to your data models; you can find the specifications in the graphviz/interfaces.py; the objects that implements those interfaces may be either django models or simple classes; take a look at the sample application, specially the file testapp/models.py
- instantiate a Graph object; you just have to give a "root" object that implements the IGraph interface
- you may customize the graph by adding some ArrowVisual and NodeVisual instances
- that's all: you can now download a dot file or an image from the Graph admin page.
CommandsMoreover, the_graphviz application provides the modelviz command that generates a dot file describing models. Usage: python manage.py modelviz app1 '['app2 ...']' > diagram.dot The command python manage.py modelviz graphviz generates a UML-like diagram of the graphviz django component:
The command python manage.py modelviz testapp generates a UML-like diagram of the sample testapp application:
|