Table of Contents
...
maxLevel 3
...
minLevel
...
2 type flat separator pipe
...
Name
...
...
Plugin
...
Part of Documentation
Description
...
Excerpt | ||
---|---|---|
| ||
Converts tables into Graphviz graphs |
Description
...
Converts tables found in the rendered body of the macro
...
into a Graphviz graph. Each row found in a table is converted to a node relationship. The Flowchart Macro is used for the rendering, so it must be enabled and working correctly. This macro simplifies use of the Graphviz support by eliminating or significantly reducing the need to know the dot language. Advanced users will still need to consult the Graphviz documentation for the multitude of attributes and settings that are possible. The primary reason of this macro is to allow SQL queries to generate graphs easily.
...
...
Documentation
- Also see the Notation guide after plugin installation.
Overview
The table or tables specified in the body of the macro can be wiki markup or created as a result of other macros. Specifically, the SQL Plugin for Confluence, CSV Macro, and the Excel
...
Macro can be used to produce the tables.
The columns in the table are interpreted as follows:
1. Node with label equal to the column. The source of a relationship.
2. Node with label equal to the column. The target of a relationship.
3. Relationship attributes.
4. Source node attributes.
5. Target node attributes.
6. First cluster number. A cluster is a subgraph that contains the source and target nodes for this row.
7. First cluster attributes.
8. Second cluster number. The second cluster is a subgraph that contains the first cluster.
9. Second cluster attributes.
Attributes are defined by Graphviz for nodes, relationships, and subgraphs (clusters). They are specified as comma separated list. Attribute values containing blanks must be surrounded by double quotes. Some commonly used attributes are:
- label - text to display
- style - examples: filled, bold, dotted, dashed, invis (for invisible)
- fillcolor - node fill color
- fontname - standard font name (enclosed in double quotes if contains a blank)
- fontsize - standard font size
- fontcolor - color usually specified as a color name like blue, grey, lightyellow
- shape - examples: rect, box, circle, ellise, triangle, polygon (together with sides attibutes), diamond, ...
- sides - number of sides for a polygon shape
- peripheries - number of node boundaries
...
References:
Parameters
Macro Specific Parameters
Parameter | Default | Macro Browser Label | Description |
---|---|---|---|
showData | false | Show the rendered data | Shows the rendered body data after the graph. |
direction | TB | Direction of graph (rankdir) | Sets the graphviz rankdir parameter
|
node | Node parameters | Sets the graphviz node parameter. The default node attributes are taken from the default Flowchart Macro behavior. By specifying the node parameter, you can override these defaults or add additional default attributes. See the Graphviz Documentation for information on attributes and settings. | |
edge | Edge parameters | Sets the graphviz edge parameter. The default edge attributes aretaken from the default Flowchart Macro behavior. By specifying the edge parameter, you can override these defaults or add additional default attributes. See the Graphviz Documentation for information on attributes and settings. | |
replace | Replace variables | A comma separated list of key:value pairs that will be used to convert column values to attributes. If a column value for an attribute column matches one of the keys, the associated value will replace the column value. This makes it easy to associate attributes to column data. If more than one attribute needs to be specified for a key, enclose the value in a single quote so that the comma gets treated as a attribute separator. | |
tables | all | Table ids or numbers to include | Comma separated list of table ids and/or table numbers contained within the body of the macro that will be used as the data for the graph. |
columns | Column numbers to include | Allows selection of the columns of the table that will be used for the graph. It must be a comma separated list of 1 or more positive integers in any order. The default value of blank represents columns=1,2,3,4,5,6,7,8,9. If the table does not contain the column indicated, it will be ignored. For example, if columns=3,13 then column 3 will be used for the source node and column 13 will be used for the target node of the relationship. All other columns will be ignored. |
Include Page | ||||
---|---|---|---|---|
|
Parameters - all are optional
- displayData - Default is false. Set to true to show the rendered body data after the graph. This is useful to see the results of a sql macro for instance.
- showWiki - Default is false. Set to true to show the generated wiki markup that is rendered to show the graph.
- node - The default node attributes are: shape=rect, style=filled, fillcolor=lightyellow, fontname="Verdana", fontsize=9. The default attributes are taken from the default Flowchart macro behavior. By specifying the node parameter, you can override these defaults or add additional default attributes. See the Graphviz Documentation for information on attributes and settings.
- edge - The default edge attributes are: arrowsize=0.8. The default attributes are taken from the default flowchart macro behavior. By specifying the edge parameter, you can override these defaults or add additional default attributes. See the Graphviz Documentation for information on attributes and settings.
- direction - The default layout direction is top to bottom (TB). Set direction=LR to layout in a left to right direction. This is equivalent to the rankdir setting.
- columns - Allows selection of the columns of the table that will be used for the graph. It must be a comma separated list of 1 or more positive integers in any order. The default is columns=1,2,3,4,5,6,7,8,9. If the table does not contain the column indicated, it will be ignored. For example, if columns=3,13 then column 3 will be used for the source node and column 13 will be used for the target node of the relationship. All other columns will be ignored.
- tables - Comma separated list of table ids and/or table numbers contained within the body of the macro that will be used as the data for the graph. Defaults to all tables found in the body.
- replace - A comma separated list of key:value pairs that will be used to convert column values to attributes. If a column value for an attribute column matches one of the keys, the associated value will replace the column value. This makes it easy to associate attributes to column data. If more than one attribute needs to be specified for a key, enclose the value in a single quote so that the comma gets treated as a attribute separator.
- ... - All other parameters are passed through to Graphviz for setting any global Graphviz parameter. Some common examples are:
- ranksep - Separation in inches between nodes.
- bgcolor - Background color.
- size - Size specified as width, height in inches. Example: size="3,5".
Usage
Simple
No Format |
---|
{graph-from-table}
| A | B |
| A | C |
{graph-from-table}
|
Relationship and node attributes
Note that headings are ignored
No Format |
---|
{graph-from-table}
|| heading 1 ignored || heading 2 ignored ||
| A node | B node | label="relationship 1", style=dashed | style=normal | fillcolor=lightblue |
| A node | C node |
| A node | D node | style=invis |
{graph-from-table}
|
Multiple tables and using parameters
No Format |
---|
{graph-from-table:node=fillcolor=lightblue,fontsize=20|edge=style=bold,color=red| replace=key1:'style=dashed, color=blue', key2:style=invis|ranksep=2.0}
| A node | B node | | shape=polygon,sides=8,peripheries=3 | |
| A node | B node | | style=dashed |
| A node | C node |
| A node | D node | key2 |
Here is a second table
| E | F | key1 |
| F | G | key1 |
{graph-from-table}
|
Subgraphs - clusters
No Format |
---|
{graph-from-table:direction=LR|ranksep=1.5|node=fillcolor=lightblue,fontsize=20| edge=style=bold,color=red|replace=key1:style=dashed}
| A node | B node | label="r1" | | | 100 | key1 |
| F | G | key1 | | | 100 | label="cluster 100" |
| X | Y | key1 | | | 200 | label="cluster 200" | 2000 | label="cluster 2000" |
{graph-from-table}
|
...
Using SQL
No Format |
---|
{graph-from-table:direction=LR|edge=color=blue|displayData=true}
{sql:dataSource=ConfluenceDS}
select PARENTID, TITLE from CONTENT where PARENTID is not NULL
{sql}
{graph-from-table}
|
Screenshots
Gallery |
---|