Pages

Sunday, November 14, 2010

Playing with Diagrams

websequencediagrams is a site that generates diagrams, sort of like GraphViz or Diagrammr.

The site has some sample code for generating the image files programmatically. Here is an example in Erlang:

To generate an image from a description in a text file such as:
client->server: POST request containing style and message
note right of server: server generates PNG file
server->client: server returns JSON containing image name
client->server: GET request for image
server->client: server returns PNG file

Read the file into Erlang and render the description:
inets:start(),
{ok, Bin} = file:read_file("descr.txt"),
wsd:render([{message, binary_to_list(Bin)}]).
The output looks like:

2 comments:

  1. there is also http://plantuml.sourceforge.net/

    ReplyDelete
  2. Very cool! Exactly like the website, without the proprietary. Thanks for the link!

    BTW, nice work on agner and beamjs, they look awesome.

    ReplyDelete