Configuring Widgets in YAML
To add widgets to a view, use parameter keys and their values. In addition to common parameters, each widget has unique parameters described on the respective widget pages.
KPI:
Process-based:
Tables:
Charts:
Auxiliary:
Common Parameters
To create a widget, use the keys listed in the table. These keys are specified in the widgets block.
| Key | Type | Definition |
|---|---|---|
| key | string | Widget key |
| type | enum | Widget type |
| apiVersion | string | Widget API version |
| settings | — | Widget settings Dependent on widget type |
Example:
widgets:
- key: barchart-123
type: BAR_CHART
apiVersion: "16"
settings:
The API version is assigned automatically to widgets when changes are saved in the YAML editor.
When creating a widget in YAML, you can specify parameters in any order. Upon saving changes in the editor, they are sorted in the same order as in the view.
Common widget parameters:
Color
To define the background color of a view or widget, use the color key.
color:
mode: VALUE
The following values are available for the mode key:
DISABLED— disabledAUTO— autoBASE— solidGRADIENT— gradientFORMULA— customRULE— by ruleVALUES— by values
Examples of using the color key are provided below.
Solid Fill
To set a solid color for a widget or view background, use the mode key with the value BASE. Example:
color:
mode: BASE
value: "#000000"
The value key is used only with the Solid color mode. The value must be a HEX color code.
Gradient Fill
To apply a gradient to a widget, use the mode key with the value GRADIENT. Example:
color:
mode: GRADIENT
startValue: "#D6D6D6"
endValue: "#292929"
classCount: 5
The startValue key specifies the HEX code of the first color in the gradient, and endValue specifies the second. The classCount key accepts values from 3 to 10 and determines the number of gradient shades.
The classCount key is optional. If omitted, the gradient is smooth.
Formula-Based Coloring
Formulas can be used with three color configuration modes:
- Custom
- By rule
- By values
To configure color using a formula, use the mode key with the value FORMULA. Example:
color:
mode: FORMULA
formula: "'#D6D6D6'"
For the By Rule (RULE) mode, specify the rule in the formula key:
color:
mode: RULE
formula: 'link: "Common"."Rule 1"'
The rule name must follow the format: link: "Group Name Where Rule Is Defined"."Rule Name".
For the By Values color mode, use the items array to list required values. Within each item, you can use the Solid or By Rule color modes.
color:
mode: VALUES
items:
- value: Value 1
color:
mode: BASE
value: "#000000"
- value: Value 2
color:
mode: RULE
formula: 'link: "Rule 2"'
Sorting
Sorting defines the display order of values in widgets—for example, alphabetically or by indicator.
To define sorting, use the sorting key. The following keys are available:
name— sorting name. By default, it uses the dimension name or formula used for sortingvalue— sorting value, which includes:mode— sorting mode. Options:FORMULAorIN_WIDGETformula— formula usedgroup— name of the group (key) from which the indicator is taken (only forIN_WIDGETmode)index— indicator index (position in the list, starting from0, only forIN_WIDGETmode)
direction— sort order: ascending (ASC) or descending (DESC)
Examples of using the sorting key are provided below.
Sorting Table Column Values
sorting:
- name: Tickets
value:
mode: IN_WIDGET
group: dimensionsAndMeasures
index: 0
direction: DESC
Sorting a Table by Formula Using the sum Function
sorting:
- name: sum("table"."column")
value:
mode: FORMULA
formula: sum("table"."column")
direction: DESC
Predefined Filters
Predefined filters can be applied to widgets. The filters block uses the following keys:
name— filter nameformula— formula useddbDataType— formula data typeformat— formatfilteringMethod— filtering methodcheckedValues— selected valuesformValues— for manually entered values (specified in thenumberRangeblock)
The dbDataType and format keys are optional.
Example of predefined filters:
filters:
- name: case_id
formula: '"case_table"."case_id"'
dbDataType: STRING
format: STRING
filteringMethod: INCLUDE
checkedValues:
- 'Value_1'
- 'Value_2'
- 'Value_3'
formValues: {}
- name: duration
formula: '"hist_all"."duration"'
dbDataType: INTEGER
format: NUMBER
filteringMethod: IN_RANGE
checkedValues: []
formValues:
numberRange:
- 0
- 100
- formula: '"hist_all"."duration"'
Formula Data Type
Formulas support various data types. The following values are used with the dbDataType key:
DATE— dateDATETIME— date and timeDATETIME64— date and time with subsecond precisionFLOAT— floating-point numbersINTEGER— integersSTRING— stringsOTHER— other
Format
The following values are used with the format key:
DATE— dateNUMBER— numberMONTH— monthDATETIME— date and timeSTRING— stringDAY_OF_WEEK— day of weekDURATION— durationHOUR— hourMONTH_YEAR— month and yearYEAR— yearQUARTER— quarterQUARTER_YEAR— quarter and yearDAY_OF_MONTH— day of monthWEEK— week
Filtering Method
The following values are used with the filteringMethod key:
INCLUDE— includedEXCLUDE— excludedEQUAL_TO— equal toNOT_EQUAL_TO— not equal toSTARTS_WITH— starts withENDS_WITH— ends withCONTAINS— containsNOT_CONTAINS— does not containEMPTY— empty valuesNONEMPTY— non-empty valuesIN_RANGE— in the rangeNOT_IN_RANGE— not in rangeGREATER_THAN— greater thanLESS_THAN— less thanGREATER_THAN_OR_EQUAL_TO— greater than or equal toLESS_THAN_OR_EQUAL_TO— less than or equal toLAST_TIME— last time
Selected Values
The checkedValues key adds or excludes multiple values in a filter. You must first specify the filtering method: INCLUDE or EXCLUDE. Example:
filters:
- name: Employee
formula: '"event_log"."responsible"'
dbDataType: STRING
format: STRING
filteringMethod: INCLUDE
checkedValues:
- "Employee #0008"
- "Employee #0031"
- "Employee #0038"
formValues: {}
Manually Entered Values
The formValues key applies custom values to a filter. The following fields and types are available:
date: stringdateRange: [string, string]duration: stringnumber: numbernumberRange: [number, number]string: stringlastTimeValue: numberlastTimeUnit: enum
Each field used with this key is optional. The key can be used with all filtering methods except INCLUDE, EXCLUDE, EMPTY, and NONEMPTY.
Example usage:
filters:
- name: Duration
formula: '"event_log"."prev_duration"'
dbDataType: INTEGER
format: NUMBER
filteringMethod: IN_RANGE
checkedValues: []
formValues:
numberRange:
- 0
- 100
Legend
The legend displays symbols and explanations used in a widget—for example, on a chart.
To enable a legend in a widget, use the legend key.
Legend Display in Widget
To set the legend position, use the position key. The following values are available:
NONE— disabledLEFT— leftRIGHT— rightTOP— topBOTTOM— bottom
Example of legend display:
legend:
position: LEFT
Alignment
To align the legend within the widget, use the align key. Available values depend on the position:
- For
LEFTandRIGHTpositions:TOP— topCENTER— centerBOTTOM— bottom
- For
TOPandBOTTOMpositions:LEFT— leftCENTER— centerRIGHT— right
Example of alignment:
legend:
position: TOP
align: LEFT
Width
To set the legend width, use the width key with the following structure:
mode— display modeFIXED— fixed (in pixels)PERCENT— percentage
Example of automatic width:
legend:
position: LEFT
align: TOP
width:
mode: FIXED
Example of percentage-based width:
legend:
position: LEFT
align: TOP
width:
mode: PERCENT
value: 20
Measure in Description
To add a measure to a widget description, use the markdownMeasures key. The following keys are available:
| Key | Type | Definition |
|---|---|---|
| name | string | Metric name |
| value | — | Metric formula |
| dbDataType | enum | Formula data type |
| format | enum | Format |
| formatting | enum | Formatting |
| formattingTemplate | string | Custom formatting Available only for CUSTOM formatting type |
| displaySign | enum | Metric appearance:NONE — standardINDICATOR — indicator with arrow (growth/decline) |
| displayCondition | — | Display condition |
Local Indicator Display Condition
To define a display condition for a local indicator, use the displayCondition block.
| Key | Type | Definition |
|---|---|---|
| mode | enum | Display mode:DISABLED — alwaysVARIABLE — by variableFORMULA — by formula |
| variableName | string | Variable name (only for VARIABLE mode) |
| variableValue | string | Variable value (only for VARIABLE mode) |
| formula | string | Formula (only for FORMULA mode) |
Was the article helpful?