Using Dashboard in Screen

To display a dashboard in a screen, use the dashboard UI component. To enable using the component in the screen, declare the dashboard namespace in the root element in the screen XML descriptor:

<window xmlns="http://jmix.io/schema/ui/window"
        xmlns:dashboard="http://jmix.io/schema/dashboards/ui"
        caption="msg://application.caption">

An example below shows adding a dashboard into the main screen:

<window xmlns="http://jmix.io/schema/ui/window"
        xmlns:dashboard="http://jmix.io/schema/dashboards/ui"
        caption="msg://application.caption">
    <layout>
        <!-- ... -->
                        <dashboard:dashboard id="mainDashboard"
                                             code="main-dashboard"
                                             timerDelay="60">
                        </dashboard:dashboard>
                        <!-- ... -->
    </layout>
</window>

The dashboard tag contains the following attributes:

  • code - a unique identifier of a dashboard.

  • jsonPath - a classPath to the dashboard JSON file.

  • timerDelay - a time period in seconds to refresh a dashboard UI.

  • assistantBeanName - a reference to a Spring bean class that should be used for adding business logic to the dashboard.

When embedding a dashboard, you should specify the code or jsonPath attribute. When they are specified both, the code attribute takes precedence over jsonPath.

You can pass parameters to a dashboard using the dashboard:parameter tag:

<dashboard:dashboard id="mainDashboard"
                     code="main-dashboard"
                     timerDelay="60">
    <dashboard:parameter name="font-size" value="huge" type="string"/>
</dashboard:dashboard>
<!-- ... -->

The parameter tag has the following required attributes:

  • name - a name of the parameter.

  • value - a value of the parameter.

  • type - a type of the value.

Also, you can create dashboard parameters in the Dashboard editor screen.