Next: , Previous: , Up: Variable Elements   [Contents]


2.4.2.2 The derivedVariable Element

derivedVariable
   :id
   :categorical=(true)
   :value
   :dependsOn=ref sourceVariable?
=> variable_extension* (format | stringFormat)? valueMapEntry*

Like sourceVariable, this element defines a variable whose values can be used elsewhere in the visualization. Instead of being read from a data source, the variable’s data are defined by a mathematical expression.

This element has the following attributes.

Attribute: id

An id is always present because this element exists to be referenced from other elements.

Attribute: categorical

Always set to true.

Attribute: value

An expression that defines the variable’s value. In theory this could be an arbitrary expression in terms of constants, functions, and other variables, e.g. (var1 + var2) / 2. In practice, the corpus contains only the following forms of expressions:

constant(0)
constant(variable)

All zeros. The reason why a variable is sometimes named is unknown. Sometimes the “variable name” has spaces in it.

map(variable)

Transforms the values in the named variable using the valueMapEntrys contained within the element.

Attribute: dependsOn

This attribute doesn’t affect the display of a table.