Class: TableColumn

TableColumn(nameopt, valuesopt, optionsopt)

new TableColumn(nameopt, valuesopt, optionsopt)

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.

Source:

Extends

Members

_clock

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.

Source:

_timeIntervals

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.

Source:

clock :DataSourceClock

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

Type:
  • DataSourceClock
Source:

clock :DataSourceClock

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

Type:
  • DataSourceClock
Source:

color :String

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

Type:
  • String
Inherited From:
Source:

dates

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

Source:

finishJulianDates

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.

Source:

formattedValues :Array

Gets formatted values of this column.

Type:
  • Array
Source:

id :String

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
Overrides:
Source:

isActive :Boolean

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

Type:
  • Boolean
Inherited From:
Source:

isEnum :Boolean

Returns whether this column is an ENUM type.

Type:
  • Boolean
Source:

isOpen :Boolean

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
Inherited From:
Source:

isSelectable :Boolean

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

Type:
  • Boolean
Inherited From:
Source:

isVisible :Boolean

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

Type:
  • Boolean
Inherited From:
Source:

items :Array.<AbsConcept>

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

Type:
Inherited From:
Source:

julianDates

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

Source:

julianDatesOrValues :Array

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

Type:
  • Array
Source:

maximumValue :Number

Gets the maximum value of this column.

Type:
  • Number
Source:

minimumValue :Number

Gets the minimum value of this column.

Type:
  • Number
Source:

name :String

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

Type:
  • String
Inherited From:
Source:

numericalValues :Array

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

Type:
  • Array
Source:

parent :Array.<VariableConcept>

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

Type:
Inherited From:
Source:

subtype :VarSubType

Gets or sets the subtype of this column.

Type:
  • VarSubType
Source:

timeIntervals :Array.<TimeIntervalCollection>

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

Type:
  • Array.<TimeIntervalCollection>
Source:

type :VarType

Gets or sets the type of this column.

Type:
  • VarType
Source:

uniqueValues :Array

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

Type:
  • Array
Source:

values :Array

Gets the values of this column.

Type:
  • Array
Source:

Methods

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

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.

Source:
Returns:

Array of values of numerator / denominator.

Type
Array.<Number>

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

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

Source:
Returns:

Array of values of the sum.

Type
Array.<Number>

destroy()

Destroy the object and release resources. Is this necessary?

Source:

getFullOptions() → {Object}

Returns the options you would pass to recreate this column.

Source:
Returns:

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

Type
Object

setTypeAndSubTypeFromName()

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

Source:

toArrayWithName() → {Array}

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

Source:
Returns:

The column as an array.

Type
Array

toggleActive()

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

Inherited From:
Source:

toggleOpen()

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.

Inherited From:
Source: