Options
All
  • Public
  • Public/Protected
  • All
Menu

column combiner which uses a custom JavaScript function to combined the values The script itself can be any valid JavaScript code. It will be embedded in a function. Therefore the last statement has to return a value.

In case of a single line statement the code piece statement return will be automatically prefixed.

The function signature is:
(row: any, index: number, children: Column[], values: any[], raws: (number|null)[]) => number

param: row
the row in the dataset to compute the value for
param: index
the index of the row
param: children
the list of LineUp columns that are part of this ScriptColumn
param: values
the computed value of each column (see children) for the current row
param: raws
similar to values. Numeric columns return by default the normalized value, this array gives access to the original "raw" values before mapping is applied
returns:
the computed number in the range [0, 1] or NaN

In addition to the standard JavaScript functions and objects (Math, ...) a couple of utility functions are available:

max(arr: number[]) => number
computes the maximum of the given array of numbers
min(arr: number[]) => number
computes the minimum of the given array of numbers
extent(arr: number[]) => [number, number]
computes both minimum and maximum and returning an array with the first element the minimum and the second the maximum
clamp(v: number, min: number, max: number) => number
ensures that the given value is within the given min/max value
normalize(v: number, min: number, max: number) => number
normalizes the given value (v - min) / (max - min)
denormalize(v: number, min: number, max: number) => number
inverts a normalized value v * (max - min) + min
linear(v: number, input: [number, number], output: [number, number]) => number
performs a linear mapping from input domain to output domain both given as an array of [min, max] values. denormalize(normalize(v, input[0], input[1]), output[0], output[1])

Hierarchy

Implements

Index

Constructors

Properties

_children: Column[] = []
desc: Readonly<IColumnDesc>
parent: Readonly<IColumnParent> = null

parent column of this column, set when added to a ranking or combined column

DEFAULT_SCRIPT: "let s = 0;\ncol.forEach((c) => s += c.v);\nreturn s / col.length" = DEFAULT_SCRIPT
EVENT_ADD_COLUMN: "addColumn" = 'addColumn'
EVENT_COLOR_MAPPING_CHANGED: "colorMappingChanged" = NumberColumn.EVENT_COLOR_MAPPING_CHANGED
EVENT_DIRTY: "dirty" = 'dirty'
EVENT_DIRTY_CACHES: "dirtyCaches" = 'dirtyCaches'
EVENT_DIRTY_HEADER: "dirtyHeader" = 'dirtyHeader'
EVENT_DIRTY_VALUES: "dirtyValues" = 'dirtyValues'
EVENT_FILTER_CHANGED: "filterChanged" = 'filterChanged'
EVENT_GROUP_RENDERER_TYPE_CHANGED: "groupRendererChanged" = 'groupRendererChanged'
EVENT_LABEL_CHANGED: "labelChanged" = 'labelChanged'
EVENT_MAPPING_CHANGED: "mappingChanged" = NumberColumn.EVENT_MAPPING_CHANGED
EVENT_METADATA_CHANGED: "metaDataChanged" = 'metaDataChanged'
EVENT_MOVE_COLUMN: "moveColumn" = 'moveColumn'
EVENT_REMOVE_COLUMN: "removeColumn" = 'removeColumn'
EVENT_RENDERER_TYPE_CHANGED: "rendererTypeChanged" = 'rendererTypeChanged'
EVENT_SCRIPT_CHANGED: "scriptChanged" = 'scriptChanged'
EVENT_SUMMARY_RENDERER_TYPE_CHANGED: "summaryRendererChanged" = 'summaryRendererChanged'
EVENT_VISIBILITY_CHANGED: "visibilityChanged" = 'visibilityChanged'
EVENT_WIDTH_CHANGED: "widthChanged" = 'widthChanged'
FLAT_ALL_COLUMNS: -1 = -1

magic variable for showing all columns

Accessors

  • get canJustAddNumbers(): boolean
  • get description(): string
  • Returns string

  • get fixed(): boolean
  • Returns boolean

  • get fqid(): string
  • returns the fully qualified id i.e. path the parent

    Returns string

  • get fqpath(): string
  • Returns string

  • get frozen(): boolean
  • Returns boolean

  • get id(): string
  • Returns string

  • get label(): string
  • Returns string

  • get length(): number

Methods

  • assignNewId(idGenerator: () => string): void
  • clearFilter(): boolean
  • createEventList(): string[]
  • detach(): void
  • dump(toDescRef: (desc: any) => any): any
  • fire(type: string | string[], ...args: any[]): void
  • flatten(r: IFlatColumn[], offset: number, levelsToGo?: number, padding?: number): number
  • forward(from: IEventHandler, ...types: string[]): void
  • forwards one or more events from a given dispatcher to the current one i.e. when one of the given events is fired in 'from' it will be forwarded to all my listeners

    Parameters

    • from: IEventHandler

      the event dispatcher to forward from

    • Rest ...types: string[]

      the event types to forward

    Returns void

  • getExportValue(row: IDataRow, format: "text" | "json"): any
  • getGroupRenderer(): string
  • getNumberFormat(): (n: number) => string
  • getRange(): [string, string]
  • getRenderer(): string
  • getScript(): string
  • getSummaryRenderer(): string
  • getVisible(): boolean
  • getWidth(): number
  • groupByMe(): boolean
  • groupSortByMe(ascending?: boolean, priority?: number): boolean
  • hide(): void
  • insertAfterMe(col: Column): boolean
  • insertBeforeMe(col: Column): boolean
  • isFiltered(): boolean
  • isGroupSortedByMe(): { asc: "asc" | "desc"; priority: number }
  • isGroupedBy(): number
  • isLoaded(): boolean
  • isSortedByMe(): { asc: "asc" | "desc"; priority: number }
  • isVisible(): boolean
  • listenersChanged(_type: string, _active: boolean): void
  • markDirty(type?: "header" | "values" | "all"): void
  • moveImpl(col: Column, index: number, oldIndex: number): Column
  • removeImpl(col: Column, index: number): boolean
  • removeMe(): boolean
  • setGroupRenderer(renderer: string): void
  • setRenderer(renderer: string): void
  • setScript(script: string): void
  • setSummaryRenderer(renderer: string): void
  • setVisible(value: boolean): void
  • setWidth(value: number): void
  • setWidthImpl(value: number): void
  • show(): void
  • sortByMe(ascending?: boolean, priority?: number): boolean
  • toggleMyGroupSorting(): boolean
  • toggleMySorting(): boolean
  • unforward(from: IEventHandler, ...types: string[]): void