views:

33

answers:

2

I need a way for render a tree-like structures, similar to flowcharts.

Surprisingly, I can't find(or I'm doing wrong) a suitable tool.

First, I looked at SVG. But I couldn't find a way to draw a bounding box around the text without using ECMAScript: I tried to do a simple thing drawing two text surrounded by boxes and linked by a line, centered by sides(some thing like O-O, where O is a box with text).And when you use ECMAScript, you heavily limit the tools that can be used for SVG rendering(for example you can't convert corrently such SVG to png or pdf with ImageMagick).

Second, I tried Asymptote, but it is quite heavy when you start manipulating with text(you need an LaTeX system installed and configured).

I look for a tool in which you can:

  1. Programmatically access to font properties: baseline, ascent, descent, height
  2. Computing height/width of a string(or the bounding box)
  3. basic vector graphics functionality like drawing lines, shapes etc.

I don't think that's a hard stuff. For example, all such functionality exists for example in Java2D. Sure, I can use it as last resort and get raster graphics, but may be there is something handy to use?

A: 

Not sure if it should be free?

Here's a commercial solution with an extensive API http://www-01.ibm.com/software/integration/visualization/java/

Houtman
+1  A: 

Have you looked at GraphViz (http://www.graphviz.org/)? It does not really match your requirements since you give up some control and instead let the tool do the layout and rendering based on a declarative a description of a graph or tree, but I have found it to be the easiest way to generate tree-like output.

Jörn Horstmann