Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java library to create and dynamically modify business diagrams

I am looking for a good java library to manipulate box, arrows and labels in order to dynamically create and fill diagrams like the following and render them to a png : enter image description here Another example enter image description here

I can create a static template to be filled later, but I will need to dynamically create labels for every box and edges in the diagrams.

For now I have tried using batik to manipulate an svg template but creating multiline labels for the edges is proving quite complicated. The SVG way with batik seems to force me to create 1 text object for each label line with absolute positioning for each which is a real pain.

I would like to be able to define the label specifying only the text and the link they relate to, eventually some hints as to how it should be placed and let the library place them.

Any suggestions ?

like image 983
Jean Avatar asked Nov 14 '22 00:11

Jean


1 Answers

If this is in a commercial scenario, the Java graph drawing library yFiles can be a good match for your requirements:

You can use a convenient API to create and style your diagram and automatically layout the diagram with lots and lots options to constrain the resulting layout to suit your needs. Multi-line and (simple) HTML labels are supported out-of-the-box. Also you can export to PNG (as well as other pixel based image formats) and vector graphics formats like SVG, PDF, EPS.

This can be done both in a regular Java (Swing) application as well as in a headless environment (e.g. to create images on a server and to send them to a web-based thin client dynamically).

To get a feel what can be done using that library, I suggest you take a look at the freely available graph editor application "yEd" that is based on yFiles and lets you try out the above steps in an interactive manner.

(Disclosure: I work for yWorks, but on Stackoverflow I do not represent my employer.)

like image 134
Sebastian Avatar answered Nov 15 '22 13:11

Sebastian