tinyactors graph
Draw each chart, or list its boxes and edges.
Usage
tinyactors graph [options] INPUT...Lays each chart out as nested boxes for its states and orthogonal routes for its transitions. With -f svg it writes the picture; the other formats list each box and edge. Reads one image (.tai), one snapshot, one system manifest or SCXML charts, compiled together into one image first. --segment picks a snapshot's image, and - reads standard input.
Options
-W, --warnings-as-errorsRefuse a chart that compiles with a warning.-I, --include DIRSearchDIRfor a src that is not beside the file naming it, in the order given. Repeatable.-c, --chart NAMELook at the chart namedNAMEonly. Repeatable.-s, --segment NRead the image that segment N of a snapshot runs. Default: the newest live segment.--direction DIRECTIONLay the states out inDIRECTION. Values: down (top to bottom) or right (left to right). Default: down.--theme THEMEDraw the colours ofTHEMEwith-fsvg. Values: auto (the reader's preference), light or dark. Default: auto.--highlight STATEMark the box ofSTATE. Repeatable.--pathMark the path the path command finds to--tofrom--from, its steps numbered.-t, --to STATEEnd the path of--pathatSTATE.--from STATEStart the path of--pathatSTATE. Default: the initial configuration.-d, --depth NFold every compound or parallel state nested deeper than N levels into one box.--fold STATEFold the compound or parallel stateSTATEinto one box. Repeatable.
Configure output formats like -f json using the shared options on the command reference.
Examples
tinyactors graph -f svg order.scxml > order.svgDraw a chart as SVG.
tinyactors graph -f svg --chart payment shop.tai > payment.svgDraw one chart of an image.
tinyactors graph -f svg --direction right --theme dark order.scxml > order.svgDraw a chart left to right in dark colours.
tinyactors graph -f svg --path --to shipped --highlight cancelled order.scxml > shipping.svgMark the path to shipped and highlight cancelled.
tinyactors graph -f svg --depth 1 --fold checkout shop.scxml > overview.svgFold states nested deeper than one level, and checkout.
tinyactors graph -f json order.tai{
"charts": [
{
"name": "order",
"width": 821,
"height": 432,
"boxes": [
{
"state": "/scxml",
"kind": "compound",
"parent": "",
"drawnAs": "root",
"x": 0,
"y": 0,
"width": 821,
"height": 432
},
{
"state": "open",
"kind": "atomic",
"parent": "/scxml",
"drawnAs": "atomic",
"x": 508,
"y": 40,
"width": 276,
"height": 58
},
{
"state": "paying",
"kind": "atomic",
"parent": "/scxml",
"drawnAs": "atomic",
"x": 278,
"y": 160,
"width": 480,
"height": 34
},
{
"state": "paid",
"kind": "atomic",
"parent": "/scxml",
"drawnAs": "atomic",
"x": 413,
"y": 298,
"width": 78,
"height": 34
},
{
"state": "shipped",
"kind": "final",
"parent": "/scxml",
"drawnAs": "final",
"x": 414,
"y": 384,
"width": 77,
"height": 34
},
{
"state": "cancelled",
"kind": "final",
"parent": "/scxml",
"drawnAs": "final",
"x": 592,
"y": 298,
"width": 92,
"height": 34
}
],
"edges": [
{
"source": "open",
"target": "paying",
"events": "checkout",
"condition": "total > 0",
"drawnAs": "forward",
"route": "518,98 518,160"
},
{
"source": "open",
"target": "cancelled",
"events": "cancel",
"condition": "",
"drawnAs": "forward",
"route": "726,98 726,150 781,150 781,288 667,288 667,298"
},
{
"source": "paying",
"target": "paid",
"events": "charge.ok",
"condition": "",
"drawnAs": "forward",
"route": "398,194 398,278 452,278 452,298"
},
{
"source": "paying",
"target": "paying",
"events": "charge.declined error.communication payment.timeout",
"condition": "attempts < 3",
"drawnAs": "self",
"route": "463,194 463,210 573,210 573,194"
},
{
"source": "paying",
"target": "cancelled",
"events": "charge.declined error.communication payment.timeout",
"condition": "",
"drawnAs": "forward",
"route": "638,194 638,298"
},
{
"source": "paid",
"target": "shipped",
"events": "shipped",
"condition": "",
"drawnAs": "forward",
"route": "452,332 452,384"
}
],
"inside": [
{
"state": "open",
"events": "item.added",
"condition": "_event.data.price > 0",
"targets": ""
}
],
"problems": [
{
"kind": "labelOnEdge",
"subject": "paying → paying on charge.declined error.communication payment.timeout",
"touches": "paying → paid on charge.ok"
},
{
"kind": "labelOnEdge",
"subject": "paying → cancelled on charge.declined error.communication payment.timeout",
"touches": "open → cancelled on cancel"
}
]
},
{
"name": "payment",
"width": 242,
"height": 290,
"boxes": [
{
"state": "/scxml",
"kind": "compound",
"parent": "",
"drawnAs": "root",
"x": 0,
"y": 0,
"width": 242,
"height": 290
},
{
"state": "pending",
"kind": "atomic",
"parent": "/scxml",
"drawnAs": "atomic",
"x": 64,
"y": 40,
"width": 164,
"height": 34
},
{
"state": "authorized",
"kind": "atomic",
"parent": "/scxml",
"drawnAs": "atomic",
"x": 37,
"y": 136,
"width": 130,
"height": 34
},
{
"state": "settled",
"kind": "final",
"parent": "/scxml",
"drawnAs": "final",
"x": 14,
"y": 242,
"width": 77,
"height": 34
},
{
"state": "declined",
"kind": "final",
"parent": "/scxml",
"drawnAs": "final",
"x": 109,
"y": 242,
"width": 85,
"height": 34
}
],
"edges": [
{
"source": "pending",
"target": "authorized",
"events": "authorize",
"condition": "",
"drawnAs": "forward",
"route": "102,74 102,136"
},
{
"source": "pending",
"target": "declined",
"events": "decline",
"condition": "",
"drawnAs": "forward",
"route": "189,74 189,126 190,126 190,232 177,232 177,242"
},
{
"source": "authorized",
"target": "settled",
"events": "capture",
"condition": "",
"drawnAs": "forward",
"route": "53,170 53,242"
},
{
"source": "authorized",
"target": "declined",
"events": "void",
"condition": "",
"drawnAs": "forward",
"route": "138,170 138,242"
}
],
"inside": [],
"problems": []
}
]
}List the boxes and edges of an image's charts as JSON.
Exit status
1An input is refused: it does not compile or verify, or it is damaged or of an unknown format.1With--path, no path reaches the--tostate in any chart drawn.3A file cannot be read or written, or memory runs out.
Related pages
tinyactors statesList each chart's states as a tree in document order.tinyactors transitionsList each chart's transitions with events, conditions and targets.tinyactors eventsList every event name and the transitions, raises and sends using it.tinyactors dataList each chart's data declarations.tinyactors expressionsList each chart's expressions and scripts with where they are.tinyactors pathFind the shortest path to a state: events, conditions and transitions.tinyactors disassembleList each chart's executable content instruction by instruction.tinyactors inspectShow what an image, a snapshot or a blob holds.