Creating the stoplight symbol

The dashboard description found in Definition of the dashboard requires a stoplight symbol to show the overall status for a region. To achieve this, you need to follow these steps:

Creating a base object

In this section you will be shown how to use object gradients to create the stoplight symbol background.
  1. Open the bampalette.
  2. Create a new symbol by pressing Ctrl+N.
  3. Select and delete the Text object.
    For more information, see Deleting an object.
  4. Select the Shape object.
  5. Select Edit > Flip or Rotate > Rotate Left.
  6. Select the Paint tab in the Styling Customizer.
  7. Click the button in the Fill Paint field.
  8. Click the Color tab; then click the RGBA tab.
    Change the Red, Green and Blue settings to 0,0,70.
  9. Select the Linear Gradient tab.
  10. Move the right handle to the middle of the gradient field, as shown in the following figure.
    diasym_lineargradient58.png
    The linear gradient tab
  11. Click Apply.
    The stoplight base object is now complete.
  12. Create a category stoplights in the bampalette.
  13. Save this symbol as stoplightbasic in the stoplights category.

Using shapes to create a light template

The stoplightbasic symbol requires three lights to show the three states allowed. To do this, you create a single light object that is used as a template for the other two lights.
  1. Open the stoplightbasic symbol from the bampalette.
  2. Click Add Shape as shown in figure The Add Shape button to open the Choose Shape dialog box.
  3. Select the circle shape.
  4. Click OK.
    The circle is added to the symbol.
  5. In the Transform tab of the Styling Customizer, set the width and height of the circle to 20.
  6. In the Paint tab, set the Fill paint color of the circle to black.
    See Changing the fill style for more information.
  7. Change the name of the circle object to light .
    See Performing basic object customization for more information.

Aligning and grouping multiple objects

In the Using shapes to create a light template section, you created a single black light. You will now use this shape as the template for the other lights.
To create multiple lights:
  1. Open the stoplightbasic symbol from the bampalette.
  2. Right-click the light object.
  3. Click Copy on the pop-up menu.
  4. Press Ctrl+V twice.
    You now have three light objects: light, light2, light3.
  5. Move the light objects so they are aligned next to the base object, as shown in the following figure.
    diasym_alignlights59.png
    Align objects
  6. Select all three lights.
    For more information, see Selecting an object.
  7. Right-click one of the lights.
  8. In the pop-up menu, click Align or Distribute > Align Horizontal Center
  9. In the pop-up menu, click Align or Distribute > Distribute Vertically.
    The lights are now perfectly aligned and distributed.
  10. In the toolbar, click Group Selection.
    diasym_groupselection60.png
    The Group Selection button
  11. In the General tab of the Styling Customizer, set the attachment and anchor points to the center point as shown in the following figure.
    diasym_stoplightalign61.png
    Aligning objects in the stoplight symbol
  12. Save the stoplightbasic symbol.
Note
Each group of objects has a base object separate from the symbol base object.

Setting allowed values for a parameter

The stoplight symbol must always have one active light to display the status of the activity being monitored. This is done by setting conditions on the value of a parameter. A stoplight has three possible states:
  • Problem
  • Warning
  • Good
These states are created by limiting a parameter to values relating only to the states. As the parameter changes value, conditions set on individual objects change their appearance.
To create a parameter with only specific values allowed:
  1. Open the stoplightbasic symbol from the bampalette.
  2. Create a new Integer parameter, statusvalue .
    For more information, see Creating a new parameter.
  3. Select the statusvalue parameter in the Symbol Outline pane.
  4. Click the Allowed Values button in the Styling Customizer.
    diasym_allowedvaluesbutton62.png
    The Allowed Values button
    The Value Set Editor is displayed.
  5. Click Add.
  6. In the Value field, type 0 .
  7. In the Name field, type Good .
  8. Click OK.
  9. Add the values 1, Warning, and 2, Problem, by repeating steps 5 to 8.
  10. Click Apply.
  11. Set the Default Value for statusvalue to Good in the Styling Customizer.
The list of values is displayed in the Allowed Values field.

Setting conditions on an object

A Condition is used to transform the object or objects to which it is bound in either of the following cases:
  • A parameter changes to a specific state.
  • The object is selected.
You will use conditions to change the colors of the stoplights as the value of the statusvalue parameter changes.
To set a condition on an object:
  1. Open the stoplightbasic symbol.
  2. Right-click the light object in the Symbol Outline pane.
  3. Select New Condition.
    The New Condition dialog box opens.
  4. Set the condition in the For Symbols Where pane to read, statusvalue, equals, Problem .
  5. Click OK.
    The new condition is added under the light object in the Symbol Outline pane. The Styling Customizer displays the properties for this object when the status Problem condition is met.
    diasym_newcondition63.png
    Properties for a condition
    Note
    The settings you apply in the Styling Customizer for a condition are applied only when the condition is fulfilled.
  6. In the Paint tab, click the ellipsis button next to the Fill paint field.
    The Paint Editor opens.
  7. Set the RGB settings in the Color tab to 255, 0, 0 and press Enter.
    See Changing the fill style for more information.
  8. Click Apply.
  9. Repeat steps 2 to 8 for the light2 and light3 objects using the following values.
    Conditions
    Object
    Condition name
    Condition Setting
    RGB Value
    light2
    status warning
    statusvalue equals warning
    255,153,0
    light3
    status good
    statusvalue equals Good
    71,231,71
    The stoplightbasic symbol is now complete.
  10. Run your symbol in Preview mode to test its functionality.
    For more information, see Testing your symbol.
diasym_stoplightbasic64.png
The stoplightbasic symbol
Tip
The green status Good light is active by default when you test the stoplightbasic symbol. This is because the default value for the statusvalue parameter is Good. To change this, select the statusvalue parameter in the Symbol Outline pane and change the state of the Default Value list in the Styling Customizer.