MagicDraw 19.0 LTR Documentation


On this page

When you create or display a Legend in a diagram or table, the adornment of its Legend Items is applied to the symbols or table rows of corresponding elements. You can define the elements to which a Legend Item should be applied by specifying one of its properties in the Apply To property group. Legend Items can be applied either to Specific Elements or to Elements By Condition. If you apply a Legend to a table, you can also specify the Adorned Properties property which defines what cells of the relevant table rows should be adorned.

Important

You can specify either the Specific Elements or the Elements by Condition property of a Legend Item, but not both.


Applying Legend Items to specific elements

You can apply a Legend Item to one or multiple specific elements as described below.


To apply a Legend Item to specific elements


  1. Open the Specification window of a Legend Item you want to apply.
  2. Select the property specification cell of the Specific Elements property, and click .
  3. On the left side of the Select Elements dialog, select the elements to which you want to apply the Legend Item.
  4. Click  to add them to the Selected elements area, and click OK.
  5. Close he Specification window.


You can also apply one or multiple Legend Items to an element from its symbol.


To apply Legend Items to an element from its symbol


  1. In a diagram, right-click the shape of the element to which you want to apply Legend Items, and in the menu select Legend Item.
  2. In the open dialog, select the Legend Items you want to apply, and click the Apply button.


The example how to apply Legend Items from an element shape.

Applying Legend Items to elements by condition

Applying a Legend Item to Elements by Condition ensures that it is consistently applied to all the elements that meet the defined condition, even after you change your model.


Example

Let's say that you want to apply a Legend Item to all requirements that have a high risk level. The quickest way to do it is to create a Property Test operation. Follow the steps bellow to analyze this specific use case and define the Elements by Condition property for the Legend Item:

  1. Open the Specification window of a Legend Item.

  2. Select the specification cell of the Elements by Condition property, and  click .

  3. In the Element by Condition dialog, click  next to the Element Type box.

  4. In the Select Element Type dialog, select the Requirement type, and click OK.
  5. In the Property Test operation specification area of the Elements by Condition dialog, select the risk property and set its value to High.

    Default options

    By default, the Language is set to StructuredExpression, and the Property Test operation is selected in the Elements by Condition dialog.

  6. Click OK, and close the Specification window.


The Elements by Condition dialog with the Property Test operation defined to test if Requirements have a high risk level.

After following the above steps, the Legend Item is applied to all Requirements that have the Risk property set to high. If this use case does not meet your needs, you may enable the Expert mode, and define advanced Property Test operation properties. You may also create an operation of a different type, or create several operations for a single condition, as long as it returns Boolean data type value (true or false). In addition, you can define a condition using a different Language setting.


Applying Legend Items to specific cells of a table

When a Legend is used in a table, you can specify not only the elements to which specific Legend Items should applied (the Specific Elements or Elements By Condition properties), but also the desired properties of these elements. In other words, you can adorn specific cells of a table instead of adorning entire table rows. To do this, use the Adorned Properties property of a Legend Item.

Adorned Properties

The Adorned Properties property of a Legend Item is only effective if you use the Legend in a table.


Example

Let's say you have a Requirements Table with three columns: Name, Text and Risk., and you want to apply two legends in that table: Risk and Status. When you create or use a Legend in a table, Legend Item adornments are normally applied to enitre table rows. So in this case, you also have to specify certain element properties (table columns) to which Legend Items of each Legend should be applied. To reproduce this spesific use case, follow these steps:

  1. Create a Requirement Table with the Name, Text and Risk columns.
  2. In the table, create a Legend to indicate the risk level of Requirements and name the Legend Risk.
  3. Create and define the Legend Items for the Risk Legend by completing the following steps:
    1. Create three Legend Items indicating three possible Requirement risk levels and name them HighMedium, and Low.
    2. Open the Specification window of the first Legend Item.
    3. Specify the Legend Item adornment by selecting the desired Fill Color.
    4. Specify the Elements by Condition property by creating a Property Test operation and selecting the Risk property value the Legend Item represents.
    5. Specify Adorned Properties property by selecting the Risk property as its value.

    6. Repeat the steps from b. to e. with the rest of the Legend Items.
  4. In the same table, create a legend intended to show the status of Requirements and name the Legend Status.
  5. Create and define the Legend Items for the Status Legend by completing the following steps:
    1. Create four Legend Items indicating four possible Requirement status values and name them ClosedApprovedDisapproved and In Progress.
    2. Open the Specification window of the first Legend Item.
    3. Specify the Legend Item adornment by selecting the desired Fill Color.
    4. Specify the Elements by Condition property by creating a Property Test operation and selecting the Status property value the Legend Item represents.
    5. Specify Adorned Properties property by selecting the Name and Text properties as its values.
    6. Repeat the steps from b. to e. with the rest of the Legend Items.


After following the above steps, you have a Requirements Table with the Status and Risk Legends applied to it. The Legend Items of both Legends do not conflict because they are applied to different columns of the table, as shown below.


The figure shows a Requirement Table with the Risk and Status Legends applied to it.
The Legend Items of each Legend are applied to different columns of a table.

  • No labels