TableColumn

TableColumn

new TableColumn(nameopt, valuesopt, optionsopt)

Source:

TableColumn is a light class containing a single variable (or column) from a TableStructure. It guesses the variable type (time, enum etc) from the variable name. It extends VariableConcept, which is used to represent the variable in the NowViewing tab. This gives it isActive, isSelected and color fields. In future it may perform additional processing.

Parameters:
Name Type Attributes Description
name String <optional>

The name of the variable.

values Array.<Number> <optional>

An array of values for the variable.

options Object <optional>

Options:

Properties
Name Type Attributes Description
active Boolean <optional>

Whether the variable should start active.

tableStructure TableStructure <optional>

The table structure this column belongs to. Required so that only one column is selected at a time.

type VarType <optional>

The variable type (eg. VarType.TIME). If not present, an educated guess is made based on the name and values.

subtype VarSubType <optional>

The variable subtype (eg. VarSubType.YEAR). If not present, an educated guess is made based on the name and values.

isEndDate Boolean <optional>

True if this is has type time and is an end_date. If not present, an educated guess is made based on the name and values.

unallowedTypes Array.<VarType> <optional>

An array of types which should not be guessed. If not present, all types are allowed. Cannot include VarType.SCALAR.

displayVariableTypes Array.<VarType> <optional>

If present, only make this variable visible if its type is in this list.

replaceWithNullValues Array.<String> <optional>

If present, and this is a SCALAR type with at least one numerical value, then replace these values with null. Defaults to ['na', 'NA'].

replaceWithZeroValues Array.<String> <optional>

If present, and this is a SCALAR type with at least one numerical value, then replace these values with 0. Defaults to [null, '-']. (Blank values like '' are converted to null before they reach here, so use null instead of '' to catch missing values.)

displayDuration Number <optional>
id String <optional>

Provided so that columns can be renamed; their original name is stored as the id.

format String <optional>

A format string for this column. For numbers, this is passed as options to toLocaleString.

units String <optional>

The units of this column, if known. Not currently used internally by TableStructure or TableColumn.

chartLineColor String <optional>

The string description of the chart line color of this variable, if any.

yAxisMin Number <optional>

Override for the minimum display value of the y axis in charts.

yAxisMax Number <optional>

Override for the maximum display value of the y axis in charts.

Extends

Members

_clock

Source:

A DataSourceClock whose start and stop times correspond to the first and last visible row. This is populated by TableStructure, since it may depend on other columns. Only if type === VarType.TIME.

_timeIntervals

Source:

A TimeInterval Array giving when each row applies. This is populated by TableStructure, since it may depend on other columns. Only if type === VarType.TIME.

clock :DataSourceClock

Source:

Returns a clock whose start and stop times correspond to the first and last visible row. Only defined if type == VarType.TIME.

Type:
  • DataSourceClock

clock :DataSourceClock

Source:

Returns a clock whose start and stop times correspond to the first and last visible row. Only defined if type == VarType.TIME.

Type:
  • DataSourceClock

color :String

Source:
Inherited From:

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

Type:
  • String

dates

Source:

this.dates is a version of values that has been converted to javascript Dates. Only if type === VarType.TIME.

finishJulianDates

Source:

this.finishJulianDates is an Array of JulianDates listing the next different date in the values array, less 1 second. This is populated by TableStructure, since it may depend on other columns. Only if type === VarType.TIME.

formattedValues :Array

Source:

Gets formatted values of this column.

Type:
  • Array

id :String

Source:
Overrides:

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

isEnum :Boolean

Source:

Returns whether this column is an ENUM type.

Type:
  • Boolean

isOpen :Boolean

Source:
Inherited From:

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. This property is observable. Only used if the concept's hasChildren can return true.

Type:
  • Boolean

isSelectable :Boolean

Source:
Inherited From:

Flag to say if this if this node is selectable. This property is observable.

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.<AbsConcept>

Source:
Inherited From:

Gets or sets the items contained in this concept. This property is observable. Only used if the concept's hasChildren can return true.

Type:

julianDates

Source:

this.julianDates is a version of values that has been converted to JulianDates. Only if type === VarType.TIME.

julianDatesOrValues :Array

Source:

Returns this column's values, except for TIME-type columns, in which case the julian dates are returned.

Type:
  • Array

maximumValue :Number

Source:

Gets the maximum value of this column.

Type:
  • Number

minimumValue :Number

Source:

Gets the minimum value of this column.

Type:
  • Number

name :String

Source:
Inherited From:

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

Type:
  • String

numericalValues :Array

Source:

Gets the column's numerical values only. This is the quantity used for the legend.

Type:
  • Array

parent :Array.<VariableConcept>

Source:
Inherited From:

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

Type:

subtype :VarSubType

Source:

Gets or sets the subtype of this column.

Type:
  • VarSubType

timeIntervals :Array.<TimeIntervalCollection>

Source:

Returns an array describing when each row is visible. Only defined if type == VarType.TIME.

Type:
  • Array.<TimeIntervalCollection>

type :VarType

Source:

Gets or sets the type of this column.

Type:
  • VarType

uniqueValues :Array

Source:

Returns this column's unique values only. Only defined if non-numeric.

Type:
  • Array

values :Array

Source:

Gets the values of this column.

Type:
  • Array

Methods

(static) divideValues(numerator, denominator) → {Array.<Number>}

Source:

Divides the values of one TableColumns into another, optionally replacing those with denominator zero.

Parameters:
Name Type Description
numerator TableColumn

The column whose values form the numerator.

denominator TableColumn

The column whose values form the denominator.

Returns:

Array of values of numerator / denominator.

Type
Array.<Number>

(static) sumValues(…The) → {Array.<Number>}

Source:

Sums the values of a number of TableColumns.

Parameters:
Name Type Attributes Description
The TableColumn <repeatable>

table columns (either a single array or as separate arguments).

Returns:

Array of values of the sum.

Type
Array.<Number>

destroy()

Source:

Destroy the object and release resources. Is this necessary?

getFullOptions() → {Object}

Source:

Returns the options you would pass to recreate this column.

Returns:

An options parameter suitable for passing to new TableColumn().

Type
Object

setTypeAndSubTypeFromName()

Source:

Try to determine the best variable type based on the variable name. Sets the _type and _subtype properties.

toArrayWithName() → {Array}

Source:

Returns this column as an array, with the name as the first element, eg. ['x', 1, 3, 4].

Returns:

The column as an array.

Type
Array

toggleActive()

Source:
Inherited From:

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

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.