graphviz.pl -- Render data using graphviz
This renderer exploits graphviz to render
graphs from Prolog data. It takes two representations. The first is a
straightforward term Program(String), e.g.,
dot("digraph G {Hello->World}")
The second takes a Prolog term as input. The dot
language is represented
as follows:
Graph := graph(Statements)
| graph(Options, Statements)
| digraph(Statements)
| digraph(Options, Statements)
Options := ID | [ID] | [strict, ID]
Statements := List of statements
Statement := NodeStm | EdgeStm | AttrStm | Name = Value | SubGraph
NodeStm := NodeID | node(NodeID, AttrList)
NodeID := ID | ID:Port | ID:Port:CompassPT
CompassPT := n | ne | e | se | s | sw | w | nw | c | _
EdgeStm := (NodeID|SubGraph) (EdgeOp (NodeID|SubGraph))+
EdgeStm | edge(NodeID|SubGraph) (EdgeOp (NodeID|SubGraph))+), AttrList)
EdgeOp := - | ->
AttrStm := graph(AttrList)
| node(AttrList)
| edge(AttrList)
AttrList := List of attributes
Attribute := Name = Value
| Name(Value)
SubGraph := subgraph(ID, Statements)
- term_rendering(+Term, +Vars, +Options)//
- Renders data using graphviz. Options:
- svg(+Mode)
- One of
inline
(default) or object
, rendering the SVG using
an HTML <object> element.
- render_dot(+DotString, +Program, +Options)// is det
- Render a dot program. First checks whether Program is available.
It has two modes, producing inline SVG or producing an HTML
<object> element, which calls the server again to fetch the SVG.
- svg(+SVG:string, +Options:list)//
- Include SVG as pan/zoom image. Must be embedded in a <div> with
class 'reactive-size'.
- data_to_graphviz_string(+Data, -DOTString, -Program) is semidet[private]
- Extract the DOT data and graphviz program to run on the data.
- swish_send_graphviz(+Request)[private]
- HTTP handler to send a GraphViz graph
- remove_old_data(+Now)[private]
- Remove data that are older than 15 minutes.
- add_defaults(Statements0, Statements) is det[private]
- value(+Name, +Value)//[private]
- Emit a GraphViz value.
- is_graphviz_id(+AtomOrString) is semidet[private]
- True if AtomOrString is a valid Graphviz ID, i.e., a value that
does not need to be quoted.
- gv_attr(?AttrName, ?Element, ?Type) is nondet[private]
- Name and type-declarations for GraphViz attributes. Types are
defined my must_be/2.
- See also
- - http://www.graphviz.org/doc/info/shapes.html
- cstring(+Codes)//[private]
- Create a C-string.
dot
uses UTF-8 encoding.