7.2.4. Visualization Framework

Allows for writing reusable visualization modules that can be invoked by the Axivion Dashboard for the ability of displaying Custom Visualizations inside the Dashboard Page.

Related modules

axivion.dashboard.visualization

Main Module of the Dashboard Visualization API.

axivion.dashboard.visualization.cache_config

axivion.dashboard.visualization.output

Outputters of the Dashboard Visualization API.

7.2.4.4. Getting started

A valid visualization module must define the factory method create_visualization_writer(report_runner) returning an instance of an implementation of the interface VisualizationWriter and the python file must match the pattern visualization_*.py.

Currently a minimal valid visualization module could look like this:

# Copyright (C) 2025 Axivion GmbH
# Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group
# https://www.qt.io


from typing import Tuple

from axivion.dashboard.report import Option, ReportRunner
from axivion.dashboard.visualization import (
    VisualizationApiVersion,
    VisualizationContext,
    VisualizationWriter,
)


def create_visualization_writer(_runner: ReportRunner) -> VisualizationWriter:
    '''Factory method called by the visualization framework module loader'''
    return MyVisualizationWriter()


class MyVisualizationWriter(VisualizationWriter):
    def visualization_api_version(self) -> VisualizationApiVersion:
        return VisualizationApiVersion(1, 0)

    def get_description(self) -> str:
        return "A simple example visualization script"

    def get_options(self) -> Tuple[Option, ...]:
        return (
            Option.text(
                name="example", default="Hello World!", description="an example option"
            ),
        )

    def write_visualization(self, context: VisualizationContext) -> None:
        with context.output().plain_text() as pt:
            pt.write(context.get_option_value('example'))

Of course in order for this to do something useful, in the VisualizationWriter.write_visualization() method you will want to make use of the axivion.dashboard.Project instance supplied via Context.get_project() in order to fetch the metric values or issue lists you are interested in for your visualization.

In order to get going you most probably want to read the Custom Visualizations chapter and configure an example script on your Dashboard that you later can modify and reload the page to try new code. In case of an error you should be able to see the output of your visualization script in the Dashboard. You may want to set the Dashboard’s Log Level to debug so as to get more detailed output in case of errors.

7.2.4.5. Relation to the Reporting Framework

The Visualization Framework is closely related to the Reporting Framework and there are a lot of aspects they have in common. Among them is the executability via the Report Runner although in the visualization case it is less likely that you want to make use of that. Multi value options and Local library inclusion are two identical aspects of the frameworks.

7.2.4.6. More advanced examples

Various example visualization scripts are provided in the examples/reports sub-directory which can be found in the Axivion Suite installation directory. Find below explanations for some of them.

visualization_misra_autosar_report.py

A compliance report that works well with Misra/Autosar.

A MISRA compliance report

A Dashboard page configured to show a Misra compliance report

visualization_style_violations_donut.py

Plots the number of style violations matching a given ErrorNumber filter as a two-level donut chart grouped by ErrorNumber and Severity.

visualization_treemap.py

Visualizes the file hierarchy as a Treemap with a Heatmap overlay.

visualization_hierarchical_edge_bundles.py

Visualizes cycles between files with hierarchical edge bundles.

visualization_issue_count_grouped_by_rule.py

Groups issues by rule name and displays them in a table with expandable rows.