addWidget
Class: slmetric.dashboard.Container
Namespace: slmetric.dashboard
(To be removed) Add widget to slmetric.dashboard.Container
object
The Metrics Dashboard user interface, metricdashboard
function, slmetric
package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.
Description
adds a widget to an newWidget
= addWidget(container
,widgetType
,num
)slmetric.dashboard.Container
object.
Input Arguments
container
— Add widget to Metrics Dashboard
slmetric.dashboard.Container
object
slmetric.dashboard.Container
object for which you want to add
widgets to customize the Metrics Dashboard layout. This property is read-write.
widgetType
— Metrics Dashboard widget
Group
| Container
| SystemInfo
| GlocalInterface
| LibraryReuse
| Custom
Specify the Type
property of an
slmetric.dashboard.Container
,
slmetric.dashboard.Widget
,
slmetric.dashboard.Group
, or
slmetric.dashboard.CustomWidget
object.
Data Types: char
num
— Widget placement
int
Placement of widget in container on Metrics Dashboard. Order of widgets in the container proceeds from left to right, and then down in the container.
Output Arguments
newWidget
— New Metrics Dashboard widget
widget object
New widget that you are adding to an
slmetric.dashboard.Container
object on the Metrics Dashboard. You
can add these widgets to a container:
slmetric.dashboard.Group
slmetric.dashboard.Container
slmetric.dashboard.CustomWidget
slmetric.dashboard.Widget
Examples
Configure Compliance Metrics
You can use the Metrics Dashboard and metric APIs to obtain compliance and issues metric data on your Model Advisor configuration. To set up your Model Advisor configuration, see Use Model Advisor Configuration Editor to Customize Model Advisor. You can also use an existing check group such as the MISRA checks. After you have set up your Model Advisor configuration, follow these steps to specify the check groups for which you want to obtain compliance and issues metric data:
Open the model vdp
by
entering:
openExample('simulink_general/VanDerPolOscillatorExample')
Open the default configuration:
config=slmetric.config.Configuration.open()
Specify a metric family ID that you associate with those check groups:
famParamID = 'ModelAdvisorStandard';
Create a cell array consisting of the Check Group IDs that correspond to the check groups. Obtain a Check Group ID by opening up the Model Advisor Configuration Editor and selecting the folder that contains the group of checks. The folder contains a Check Group ID parameter.
values = {'maab', 'hisl_do178', '_SYSTEM_By Task_misra_c'};
The previous cell array specifies MAB, High-Integrity, and MISRA check groups. The
values maab
and hisl_do178
correspond to a subset
of MAB and High-Integrity System checks. To include all
checks, specify the value for the Check Group ID parameter from the
Model Advisor Configuration editor.
To set up the configuration, pass the values
cell array into the
setMetricFamilyParameterValues
method.
setMetricFamilyParameterValues(config, famParamID, values);
Point the High Integrity Compliance and High Integrity Check Issues widgets to MISRA check group. To begin, open the default configuration for the Metrics Dashboard layout.
conf = slmetric.dashboard.Configuration.open();
Obtain the slmetric.dashboard.Layout
object from the
slmetric.dashboard.Configuration
object
conf
.
layout = getDashboardLayout(conf);
Obtain the widget objects that are in the layout object.
layoutWidget=getWidgets(layout);
Obtain the compliance group from the layout. This group contains two containers. The first container contains the High Integrity and MAB Compliance and Check Issues widgets. Remove the High Integrity Compliance widget.
complianceGroup = layoutWidget(3); complianceContainers = getWidgets(complianceGroup); complianceContainerWidgets = getWidgets(complianceContainers(1)); complianceContainers(1).removeWidget(complianceContainerWidgets(1)); setMetricIDs(complianceContainerWidgets(1),... ({'mathworks.metrics.ModelAdvisorCompliance._SYSTEM_By Task_misra_c'})); complianceContainerWidgets(1).Labels={'MISRA'};
Add a custom widget for visualizing MISRA check issues metrics to the
complianceContainers
slmetric.dashboard.Container
object.
misraWidget = complianceContainers(1).addWidget('Custom', 1); misraWidget.Title=('MISRA'); misraWidget.VisualizationType = 'RadialGauge'; misraWidget.setMetricIDs(... 'mathworks.metrics.ModelAdvisorCheckCompliance._SYSTEM_By Task_misra_c'); misraWidget.setWidths(slmetric.dashboard.Width.Medium);
Save the configuration objects. These commands serialize the API information to XML files.
save(config,'FileName','MetricConfig.xml'); save(conf,'Filename','DashboardConfig.xml');
Set the active configurations.
slmetric.config.setActiveConfiguration(fullfile(pwd, 'MetricConfig.xml')); slmetric.dashboard.setActiveConfiguration(fullfile(pwd, 'DashboardConfig.xml'));
Open the Metrics Dashboard for the model vdp
.
metricsdashboard vdp
Click the All Metrics button to run all metrics.
Version History
Introduced in R2018bR2022a: Metrics Dashboard will be removed
The Metrics Dashboard user interface, metricdashboard
function, slmetric
package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)