Skip to end of banner
Go to start of banner

Graph from table macro - Cloud

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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.

Overview

The table or tables specified in the body of the macro or created as a result of other macros. Specifically, the SQL for ConfluenceCSV Macro, and the Excel Macro can be used to produce the tables.

The columns in the table are interpreted as follows:

  • Node with label equal to the column. The source of a relationship. This is the only required column.
  • Node with label equal to the column. The target of a relationship.
  • Relationship attributes.
  • Source node attributes.
  • Target node attributes.
  • First cluster number. A cluster is a subgraph that contains the source and target nodes for this row.
  • First cluster attributes.
  • Second cluster number. The second cluster is a subgraph that contains the first cluster.
  • 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

Graphviz resources

Graphviz is a powerful way of describing diagrams of any kind, using just text. Graphviz provides automatic layout of diagrams based on the text. Have a look at the following Graphviz resources.

Parameters

Macro specific parameters

Macro Editor LabelDefaultDescriptionParameter
Show the rendered dataFALSEShows the rendered body data after the graph.showData
Direction of graph (rankdir)TB

Sets the graphviz rankdir parameter

  • TB – top to bottom
  • LR – left to right
direction
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.node
Edge parameters
Sets the graphviz edge parameter. The default edge 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.edge
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.replace
Table ids or numbers to includeallComma 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.tables
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.columns


Removal notice

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

The following parameters are available with all Graphviz macros:

Macro Editor Label
Default
Description
Macro Parameter
Output typesvg

Specifies the output type to be generated by Graphviz. 

  • png
  • svg
  • jpg
  • gif
output
Profile

Specifies the profile the macro uses to read data from an external application such as GitLab or GitHub.

Profiles refer to common parameters, that administrators create and configure, to access data from external sources. Contact your administrator to know more about the profiles that are configured in your instance. Refer to the administrator guide to understand more about profiles.

This parameter is not available in Graph from table and Space graph macros.


Location of Graphviz source

Specifies the source from where the macro reads the data. 

  • blank - The body is used.
  • ^attachment - Data is read from an attachment to the current page. Input the value in the format ^Filename.extension.
  • page^attachment - Data is read from an attachment to the page name provided.
  • space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.
  • global page template name - Data is read from a global page template.
  • space:page template name - Data is read from a space template.
  • Files and templates are not applicable for Confluence Cloud. Refer to the Migration guide for more details.
  • Graphviz recognizes the commands only when you nest the commands under noformatcode, or code-pro macros, for the sources mentioned below:

    • global page template name 
    • space:page template name
script
Show Graphviz markup codeFalseShows the Graphviz markup code below the generated graph. Useful for fixing syntax errors or to see the markup that is generated by macro processing or macros like the Space graph macro.showCode
Attachment name

The name of the attachment to use. Useful when the Graphviz image must be uploaded as a new attachment or to update an existing attachment. Use of attachments is optional but can be useful for linking from other places.

Examples:

  • graphviz.png — the image is saved as an attachment to the current page.
  • page^graphviz.png — the image is saved as an attachment to the page name provided.
  • space:page^graphviz.png — the image is saved as an attachment to the page name provided in the space indicated.
attachment
Attachment versionnew

Specifies how the generated graph is persisted as an attachment.

  • New — creates a new version of the attachment.
  • Replace — replaces all previous versions of the attachment. To replace an existing attachment, the user must be authorized to remove attachments for the page specified.
  • Keep — only saves a new attachment if there is no existing attachment. An existing attachment will not be changed or updated.
attachmentVersion
Attachment comment

Specifies the comment on the attachment that is created or updated.

attachmentComment
Attachment versions to keep

Limits the number of attachment versions of a file that is attached to a page. If the maximum number of attachments exceeds the limit, then the oldest version is deleted.

This parameter is only applicable if you select New from the drop-down list under Attachment version, in the macro editor.

attachmentLimit

ThumbnailFalse

Used when an attachment is specified, and output is pngjpg, or gif. Renders graph as a thumbnail with default size 128x128px.

  • In some cases, the image and the thumbnail generated are of the same size. This is because the image is too small and fits the preview screen perfectly.
  • This parameter is not applicable for Graph macro.
thumbnail
Render wiki markup macros in bodyFalse

Set to true to render wiki markup macros found in the body before processing as Graphviz markup.

  • Only the following wiki markup macros are supported for processing as Graphviz markup:
    • noformat
    • code
    In other words, the output of any other wiki markup macro (that is not available on Cloud), is not a valid input to Graphviz macros. Though you can insert such macros in the Graphviz macro body, you are likely to encounter a rendering error in the published page.
  • This parameter is not available in Graph from table and Space graph macros.
macros
Layoutdot

Specifies which default layout algorithm to use.

  • dot− filter for drawing directed graphs
  • neato − filter for drawing undirected graphs
  • twopi− filter for radial layouts of graphs
  • circo− filter for a circular layout of graphs
  • fdp− filter for drawing undirected graphs
layout

URL to 'macro' file

(macro ~ Graphviz/ Diagraph/ Graph)


Specifies the URL link to the Graphviz file. Administrators may restrict use.

  • The URLs are restricted to the whitelisted URLs.
  • This parameter is not available in Graph from table and Space graph macros.
URL
URL user (Removed)

Specifies the user name for URL access via basic authentication.

Removal notice

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

user
URL user password  (Removed)

Specifies the user password for URL access via basic authentication. 

Removal notice

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

password
URL connection timeout
Used to increase the wait time for URL access on slower connections. timeout
File encoding

Allows the user to specify the encoding if it is different from the Confluence default (like Windows-1252, UTF-8, MacRoman). 

encoding

Other Parameters 

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

{graph-from-table}
| A | B |
| A | C |
{graph-from-table}

Relationship and node attributes

Note that headings are ignored

{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

{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

{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

{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

  • No labels