7.2.4.1. Module axivion.dashboard.visualization

Main Module of the Dashboard Visualization API.

See Visualization Framework on how to use this.

Classes

VisualizationApiVersion(major, minor)

Defines a Visualization API Version

VisualizationContext()

Visualization writing context

VisualizationRunner()

Represents the Visualization Framework used to create and execute the module.

VisualizationWriter()

Base class to implement by modules of the visualization framework.

VisualizationApiVersion

class axivion.dashboard.visualization.VisualizationApiVersion(major, minor)

Bases: object

Defines a Visualization API Version

Changes in the major version indicate incompatible API changes where scripts usually will need to be adjusted in order to target the newer version.

Changes in the minor version indicate pure API additions where you don’t need to adjust your module code and can still increase the target framework version.

The framework implementation is backwards compatible, which means that e.g. framework version 2.0 can run modules targeting 1.0 unless the supported minimum target framework version is explicitly lifted in the future.

Version History:
1.0: (Axivion Suite 7.5.0)

Initial Version

1.1: (Axivion Suite 7.6.0)

Implementations of VisualizationWriter can now specify a CacheConfig (a config objects which declares how to cache visualization artifacts among script invocations) by overriding VisualizationWriter.get_cache_config(). By default, this method returns None (None disables caching entirely).

Parameters:
  • major (int)

  • minor (int)

major: int
minor: int

VisualizationContext

class axivion.dashboard.visualization.VisualizationContext

Bases: Context

Visualization writing context

abstract output()

Returns the output writer.

Usage example:

with context.output().plain_text() as pt:
    pt.write("Hello world!")
Return type:

axivion.dashboard.visualization.output.Output

VisualizationRunner

class axivion.dashboard.visualization.VisualizationRunner

Bases: ABC

Represents the Visualization Framework used to create and execute the module.

An instance of this class is passed in the factory method used for creating a module.

abstract version()

Returns the Framework version which is the same as the Axivion Suite Version.

Return type:

typing.Tuple[int, ...]

VisualizationWriter

class axivion.dashboard.visualization.VisualizationWriter

Bases: Writer

Base class to implement by modules of the visualization framework.

abstract visualization_api_version()

The API version the module is programmed against.

You can find out the version of the API you are programming against by calling get_current_visualization_api_version(). Note, that you should not simply call get_current_visualization_api_version() in the visualization_api_version() implementation.

Return type:

axivion.dashboard.visualization.VisualizationApiVersion

get_cache_config()

Indicates whether and how to cache visualization artifacts created by this module.

If None, caching is disabled entirely. If not None, visualization artifacts are cached as specified by the returned configuration object. The default value is None—hence, caching is disabled by default. For the sake of performance (especially if there are many and long-running visualization scripts in the Dashboard), it is recommended to specify a cache configuration if possible.

Return type:

typing.Optional[axivion.dashboard.visualization.cache_config.CacheConfig]

abstract write_visualization(context)

Write the visualization.

Parameters:

context (axivion.dashboard.visualization.VisualizationContext)

Return type:

None

Functions

get_current_visualization_api_version()

The current version of the visualization api

get_current_visualization_api_version

visualization.get_current_visualization_api_version()

The current version of the visualization api

Be sure to hard-code the API version you want to program against in your VisualizationWriter implementation like this:

def visualization_api_version(self) -> VisualizationApiVersion:
    return VisualizationApiVersion(1, 1)

Also, read the documentation of VisualizationApiVersion before increasing the target api version of your module.

Return type:

axivion.dashboard.visualization.VisualizationApiVersion