Today I’m releasing a small utility for quickly viewing GraphViz (DOT) files which I’ve used many times over the past year. The project source is hosted on GitHub.
This extension integrates a modified version of the standalone ZGRViewer into the NetBeans IDE. When a GraphViz file (
*.gv) file is opened, a plain text editor is presented along with “Source” and “Visual” buttons on the document’s tool bar. When the document is saved, the plugin uses GraphViz to generate an SVG for the file which can be viewed by clicking the “Visual” button. Further changes to the graph may be made by switching back to the “Source” view. Note: if changes are made to the source file, the visual graph is only updated after the file is saved.
Here is an example from editing Block.dot in the ANTLR 4 runtime documentation. The “Visual” pane for this file is shown above.
This extension requires the following to be installed separately.
- NetBeans 7.3 Beta 2 (may also work with versions newer than this)
- GraphViz (tested with the latest stable version 2.28)
- Open the NetBeans plugin manager. On the Settings tab, click Add to add the following customizer:
- On the Available Plugins tab, you should now see an option to install the “ZGRViewer Integration” plugin. After accepting the license and installing the plugin, you should be ready to configure and use the viewer.
After installation, if the
dot executable is not in your system path, you’ll need to configure the path to
dot before using the plugin. In the editor options under the Miscellaneous section is a GraphViz tab. Here is an example configuration on the Directories tab:
You may also wish to enable anti-aliasing on the Visualizer tab: