7.2.4.3. Module axivion.dashboard.visualization.output

Outputters of the Dashboard Visualization API.

Classes

Grid(out, indentation_level, columns[, ...])

Widget which displays other widgets in a grid layout.

Markdown(out, indentation_level[, cache_config])

Widget that renders the given Markdown string.

Output(out, cache_config)

Root widget container.

PlainText(out, indentation_level[, cache_config])

Widget that outputs plain text - without any formatting.

SVG(out, indentation_level[, cache_config])

Widget that outputs SVG.

Table(out, indentation_level, options[, ...])

Widget that outputs tabular data.

Vega(out, indentation_level[, cache_config])

Widget that outputs Vega JSON.

Grid

class axivion.dashboard.visualization.output.Grid(out, indentation_level, columns, cache_config=None)

Bases: Closeable

Widget which displays other widgets in a grid layout.

The methods to write the sub-widgets each take an optional style argument which is a mapping of CSS properties to values. For example the column span can be set to 2 with style={“grid-column-end”: “span 2”}.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.grid`

Parameters:
plain_text(style=None)
Parameters:

style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.PlainText]

markdown(style=None)
Parameters:

style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Markdown]

svg(style=None)
Parameters:

style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.SVG]

vega(style=None)
Parameters:

style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Vega]

table(options=None, style=None)

Starts a table widget.

Parameters:
  • options (typing.Optional[typing.Mapping[str, typing.Any]]) – see TableOptions

  • style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Table]

grid(*, columns, style=None)
Parameters:
  • columns (int)

  • style (typing.Optional[typing.Mapping[str, str]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Grid]

Markdown

class axivion.dashboard.visualization.output.Markdown(out, indentation_level, cache_config=None)

Bases: Closeable

Widget that renders the given Markdown string. More specifically CommonMark is expected, see https://commonmark.org for more details. Images are not supported.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.markdown`

Parameters:
write(part)

Appends the given markdown to the widget.

Initially, the widget is empty.

Parameters:

part (str) – the markdown snippet to append

Return type:

None

Output

class axivion.dashboard.visualization.output.Output(out, cache_config)

Bases: object

Root widget container.

Allows only one child.

Usually obtained via :py:meth:`axivion.dashboard.visualization.VisualizationContext.output`

Parameters:
plain_text()
Return type:

typing.ContextManager[axivion.dashboard.visualization.output.PlainText]

markdown()
Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Markdown]

svg()
Return type:

typing.ContextManager[axivion.dashboard.visualization.output.SVG]

vega()
Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Vega]

table(options=None)
Parameters:

options (typing.Optional[typing.Mapping[str, typing.Any]])

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Table]

grid(*, columns)
Parameters:

columns (int)

Return type:

typing.ContextManager[axivion.dashboard.visualization.output.Grid]

PlainText

class axivion.dashboard.visualization.output.PlainText(out, indentation_level, cache_config=None)

Bases: Closeable

Widget that outputs plain text - without any formatting.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.plain_text`

Parameters:
write(part)

Appends the given text to the widget text.

Initially, the widget text is the empty string.

Parameters:

part (str) – the text snippet to append

Return type:

None

SVG

class axivion.dashboard.visualization.output.SVG(out, indentation_level, cache_config=None)

Bases: Closeable

Widget that outputs SVG.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.svg`

Parameters:
write_xml(svg_xml)

Writes the given SVG document into the widget.

If the XML document specifies an encoding, it has to be UTF-8.

Parameters:

svg_xml (str) – expected to contain a complete svg+xml document

Return type:

None

Table

class axivion.dashboard.visualization.output.Table(out, indentation_level, options, cache_config=None)

Bases: Closeable

Widget that outputs tabular data.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.table`

Parameters:
columns(columns)

Writes the descriptions of the tables columns.

Parameters:

columns (typing.List[typing.Mapping[str, typing.Any]]) – A list of ColumnInfo objects.

The width of a column normally refers to a pixel count, but it is possible to get a percentage-based layout by specifying values less than 1. In that case, column resizing will be disabled.

Example:

[
    {
        "key": "id",
        "type": "string",
        "linkKey": "id_link",
        "canFilter": true,
        "canSort": true,
        "showByDefault": true,
        "alignment": "left",
        "width": 0.75
    },
    {
        "key": "count",
        "type": "number",
        "canFilter": false,
        "canSort": true,
        "showByDefault": true,
        "alignment": "right",
        "width": 0.25
    }
]
rows(rows)

Writes the data content of the table.

Parameters:

rows (typing.Iterable[typing.Dict[str, typing.Any]]) – A list of objects that match the description of the previously written columns.

Example:

[
    {
        "id": "json",
        "id_link": "https://www.json.org/",
        "count": 4
    },
    {
        "id": "internal",
        "id_link": "/url/relative/to/dashboard/basepath",
        "count": 8
    }
]

Vega

class axivion.dashboard.visualization.output.Vega(out, indentation_level, cache_config=None)

Bases: Closeable

Widget that outputs Vega JSON.

Usually obtained via :py:meth:`axivion.dashboard.visualization.output.Output.vega`

Parameters:
write_json(vega_json)

Writes the given Vega JSON object into the widget.

Parameters:

vega_json (str) – expected to contain a complete vega json object

Return type:

None