Block diagram (BlockDiag)

BlockDiag creates nodes by mentioning them, which makes it the fastest way to turn a chain of steps into a diagram.


#What this example shows

  • Nodes created implicitly by an arrow chain.

  • A group, which draws a labelled box.

  • Shapes and colours set per node.


#A worked example

Open it, edit it, or copy the source below.

Block diagram (BlockDiag)

The source, which you can paste into a new diagram and edit:

blockdiag {
  ingest [label = "Ingest", shape = beginpoint];
  validate [label = "Validate", shape = diamond];
  transform [label = "Transform"];
  store [label = "Store", shape = flowchart.database];
  notify [label = "Notify", shape = endpoint];
  reject [label = "Reject", color = "#ffdddd"];

  ingest -> validate -> transform -> store -> notify;
  validate -> reject;

  group {
    label = "Pipeline";
    color = "#f1f5f9";
    validate; transform; store;
  }
}

#Making it your own

  • Every statement ends with a semicolon; that is the usual syntax error.

  • Shapes include box, roundedbox, diamond, ellipse, beginpoint, endpoint and the flowchart set.

  • For real layout control, D2 or Graphviz will serve you better.



Mention a node and it exists.