DisplayVariablesConcept

DisplayVariablesConcept

new DisplayVariablesConcept(nameopt, optionsopt, getColorCallbackopt)

Source:

Represents a concept which contains a list of variables which can be used to change the appearance of data. A DisplayVariablesConcept contains an items array of VariableConcepts.

Parameters:
Name Type Attributes Default Description
name String <optional>
'Display Variable'

Display name of this concept.

options Boolean | Object <optional>

Options; for backwards compatibility, if a boolean is passed, it is interpreted as options.allowMultiple. Also, VariableConcept options are passed through.

getColorCallback function <optional>

For backwards compatibility, a third argument is interpreted as options.getColorCallback. Use options.getColorCallback in preference.

options.allowMultiple Boolean <optional>
false

Set to true if more than one checkbox can be selected at a time.

options.requireSomeActive Boolean <optional>
false

Set to true if at least one checkbox must be selected at all times.

options.getColorCallback function <optional>

A function with no arguments that returns a color for the VariableConcept. If undefined, no color is set.

options.items Array.<Concept> <optional>

The array of concepts contained in this group. Each item's parent property is overridden with this.

options.isOpen Boolean <optional>

Whether this concept item is currently open.

options.isSelectable Boolean <optional>

Whether this node is selectable.

options.exclusiveChildIds Array.<String> <optional>

A list of child ids which cannot be selected at the same time as any other child. Default [].

Extends

Members

allowMultiple :Boolean

Source:

Gets or sets a flag for whether more than one checkbox can be selected at a time. Default false.

Type:
  • Boolean

color :String

Source:
Inherited From:

String describing the color of this node, if applicable. This property is observable.

Type:
  • String

exclusiveChildIds :Array.<String>

Source:

Gets or sets a list of child ids which cannot be selected at the same time as any other child. Defaults to []. Only relevant with allowMultiple = true. Eg. Suppose the child concepts have ids "10" for 10 year olds, etc, plus "ALL" for all ages, "U21" and "21PLUS" for under and over 21 year olds. Then by specifying ["ALL", "U21", "21PLUS"], when the user selects one of these values, any other values will be unselected. And when the user selects any other value (eg. "10"), if any of these values were selected, they will be unselected.

Type:
  • Array.<String>

getColorCallback :function

Source:

Gets or sets a function with no arguments that returns a color for the VariableConcept. If undefined, no color is set (the default).

Type:
  • function

id :String

Source:
Inherited From:

Gets or sets the id of the concept item. By default this is the same as the name. It is allowed to be different eg. for csv files with tersely-named columns.

Type:
  • String

isActive :Boolean

Source:
Inherited From:

Gets or sets a value indicating whether this variable is currently active. This property is observable.

Type:
  • Boolean

isOpen :Boolean

Source:
Overrides:

Gets or sets a value indicating whether this concept item is currently open. When an item is open, its child items (if any) are visible. Default true.

Type:
  • Boolean

isSelectable :Boolean

Source:
Overrides:

Gets or sets a flag indicating whether this node is selectable.

Type:
  • Boolean

isVisible :Boolean

Source:
Inherited From:

Gets or sets a value indicating whether this concept is visible. Defaults to true.

Type:
  • Boolean

items :Array.<Concept>

Source:
Overrides:

Gets or sets the array of concepts contained in this group. If options.items is present, each item's parent property is overridden with this.

Type:

name :String

Source:
Inherited From:

Gets or sets the name of the concept item. This property is observable.

Type:
  • String

parent :Array.<VariableConcept>

Source:
Inherited From:

Gets or sets the parent for a node. This property is observable.

Type:

requireSomeActive :Boolean

Source:

Gets or sets a flag for whether at least one checkbox must be selected at all times. Default false.

Type:
  • Boolean

toggleActiveCallback :function

Source:

Gets or sets a function which is called whenever a child item is successfully toggled. Its sole argument is the toggled child item.

Type:
  • function

Methods

getNodes(condition) → {Array.<Concept>}

Source:

Gets a flat array of all of this concept's descendants, including itself, which meet a given condition.

Parameters:
Name Type Description
condition function

A function of a concept, which returns a boolean.

Returns:
Type
Array.<Concept>

toggleActive()

Source:
Inherited From:

Toggles the VariableConcept#isActive property, by using the parent's toggleActiveItem (if defined), or else manually.

toggleActiveItem(concept)

Source:

If appropriate, based on this.allowMultiple, this.requireSomeActive and this.exclusiveChildIds, sets the VariableConcept#isActive property on all children, so that only the provided concept is activated. This is called by the VariableConcept's toggleActive function. If not appropriate, simply toggles the concept without changing any others. (For backwards compatibility, VariableConcept does not call this function if there's no possibility it's needed.)

Parameters:
Name Type Description
concept VariableConcept

The concept to make active/inactive.

toggleOpen()

Source:
Inherited From:

Toggles the Concept#isOpen property. If this item's list of children is open, calling this method will close it. If the list is closed, calling this method will open it.

Type Definitions

setSelected(index, varName, makeActive)

Source:

Function that is called when a variable is selected or unselected.

Parameters:
Name Type Description
index Integer

Index of the selected variable in the list of variables.

varName String

The name of the selected variable.

makeActive Boolean

Whether to make this variable active or not.