Options
All
  • Public
  • Public/Protected
  • All
Menu

UpSet.js Model - v1.11.0

Index

Type aliases

ISetCombination

union of all set combination types

Type parameters

  • T = any

ISetCombinations

ISetCombinations<T>: readonly ISetCombination<T>[]

readonly array of set combinations

Type parameters

  • T = any

ISetLike

ISetLike<T>: ISet<T> | ISetCombination<T>

union of a set or a set combination

Type parameters

  • T = any

ISetLikes

ISetLikes<T>: readonly ISetLike<T>[]

readonly array of set like objects

Type parameters

  • T = any

ISets

ISets<T>: readonly ISet<T>[]

readonly array of sets

Type parameters

  • T = any

NumericScaleTick

NumericScaleTick: { label?: string; value: number }

Type declaration

  • Optional label?: string
  • value: number

SetCombinationType

SetCombinationType: "intersection" | "union" | "composite" | "distinctIntersection"

UpSetCompressedIndices

UpSetCompressedIndices: readonly number[] | string

UpSetQueries

UpSetQueries<T>: readonly UpSetQuery<T>[]

Type parameters

  • T = any

UpSetQuery

UpSetQuery<T>: UpSetElemQuery<T> | UpSetCalcQuery<T> | UpSetSetQuery<T>

Type parameters

  • T = any

Variables

SET_JOINERS

SET_JOINERS: { composite: string; distinctIntersection: string; intersection: string; union: string } = ...
upsetjs/model

https://github.com/upsetjs/upsetjs

Copyright (c) 2021 Samuel Gratzl sam@sgratzl.com

Type declaration

  • composite: string
  • distinctIntersection: string
  • intersection: string
  • union: string

Functions

asCombination

asCombinations

  • helper to create a proper data structures for UpSet.js sets by adding extra properties

    Type parameters

    • T

    • S: { elems: readonly T[]; name: string }

    Parameters

    • sets: readonly S[]

      set like structures

    • type: SetCombinationType

      hint for the type of combinations

    • toSets: (s: S) => ISets<T>

      resolver of the contained sets

    Returns (S & ISetCombination<T>)[]

asSet

  • asSet<T, S>(set: S): S & ISet<T>
  • helper method to create proper UpSet.js structures by adding extra properties

    Type parameters

    • T

    • S: { elems: readonly T[]; name: string }

    Parameters

    • set: S

      the set to complete

    Returns S & ISet<T>

asSets

  • helper to create a proper data structures for UpSet.js sets by adding extra properties

    Type parameters

    • T

    • S: { elems: readonly T[]; name: string }

    Parameters

    • sets: readonly S[]

      set like structures

    • options: PostprocessSetOptions = {}

      additional postprocessing options

    Returns (S & ISet<T>)[]

Const bandScale

  • bandScale(domain: string[], size: number, padding: number): BandScaleLike

extractCombinations

extractFromExpression

  • extract sets and combinations out of a given list of static combination information. In addition an accessor is used to specify the set names

    Type parameters

    • T: { cardinality: number }

    Parameters

    • combinations: readonly T[]

      list of combinations

    • accessor: (elem: T) => string[]

      accessor to get the list of sets the combination belong to

        • (elem: T): string[]
        • Parameters

          • elem: T

          Returns string[]

    • Optional options: ExtractFromExpressionOptions

      hints about the given combinations

    Returns { combinations: readonly (T & ISetCombination<unknown>)[]; sets: ISets<unknown> }

  • extract sets out of a given element array which have a .sets property

    Type parameters

    • T: { cardinality: number; sets: string[] }

    Parameters

    Returns { combinations: readonly (T & ISetCombination<unknown>)[]; sets: ISets<unknown> }

extractSets

  • extract sets out of a given element array, where an accessor is used to specify the set names

    Type parameters

    • T

    Parameters

    • elements: readonly T[]

      list of elements

    • acc: (elem: T) => string[]

      accessor to get the list of sets the element belong to

        • (elem: T): string[]
        • Parameters

          • elem: T

          Returns string[]

    • Optional options: PostprocessSetOptions

      postprocess options

    Returns ISets<T>

  • extract sets out of a given element array which have a .sets property

    Type parameters

    • T: { sets: string[] }

    Parameters

    Returns ISets<T>

fromDump

fromIndicesArray

  • fromIndicesArray<T>(indices: string | readonly number[], elements: readonly T[]): readonly T[]
  • reverse operation of toIndicesArray by supporting compressed indices notation

    Type parameters

    • T

    Parameters

    • indices: string | readonly number[]

      the (compressed) indices

    • elements: readonly T[]

      the elements to refer by index

    Returns readonly T[]

fromSetName

  • fromSetName<T>(sets: ISets<T>, symbol?: RegExp): (s: { name: string }) => ISet<T>[]
  • helper method to extract the sets in a set combination from its name, e.g. S1&S2 => S1,S2

    Type parameters

    • T

    Parameters

    • sets: ISets<T>

      the list of possible sets

    • symbol: RegExp = ...

      the regex to split a name

    Returns (s: { name: string }) => ISet<T>[]

      • (s: { name: string }): ISet<T>[]
      • Parameters

        • s: { name: string }
          • name: string

        Returns ISet<T>[]

fromStaticDump

generateCombinations

generateDistinctOverlapFunction

generateIntersectionOverlapFunction

generateOverlapFunction

generateOverlapLookup

generateOverlapLookupFunction

  • generateOverlapLookupFunction<T>(matrix: string | readonly readonly number[][], sets: ISets<T>, combinations: ISetCombinations<T>, toKey?: (v: ISetLike<T>) => string): { combinationIndex: Map<string, number>; compute: ISetOverlapFunction<T>; setIndex: Map<string, number> }
  • uses the given overlap lookup function to generate a compute and indices functions

    Type parameters

    • T

    Parameters

    • matrix: string | readonly readonly number[][]

      the compressed overlap matrix

    • sets: ISets<T>

      the sets of the plot

    • combinations: ISetCombinations<T>

      the set combinations of the plot

    • toKey: (v: ISetLike<T>) => string = toKeyImpl

    Returns { combinationIndex: Map<string, number>; compute: ISetOverlapFunction<T>; setIndex: Map<string, number> }

    • combinationIndex: Map<string, number>
    • compute: ISetOverlapFunction<T>
    • setIndex: Map<string, number>

generateUnionOverlapFunction

isCalcQuery

isElemQuery

isGenerateSetCombinationOptions

isSet

  • isSet(v: any): v is ISet<any>

isSetCombination

isSetLike

isSetQuery

isUpSetQuery

Const linearScale

Const logScale

mergeColors

  • mergeColors(colors: readonly (undefined | string)[]): string | undefined
  • Parameters

    • colors: readonly (undefined | string)[]

    Returns string | undefined

parseColor

  • parseColor(color?: string): [number, number, number]
  • Parameters

    • Optional color: string

    Returns [number, number, number]

queryElemOverlap

  • helper method to create an overlap function of elements for a given query

    Type parameters

    • T

    Parameters

    • query: UpSetQuery<T>

      the query

    • what: keyof SetElemOverlap<T>

      type of overlap

    • Optional toElemKey: (e: T) => string

      optional key function

        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns (s: ISetLike<T>) => readonly T[] | null

      • helper method to create an overlap function of elements for a given query

        Parameters

        Returns readonly T[] | null

queryOverlap

  • helper method to create an overlap function for a given query

    Type parameters

    • T

    Parameters

    • query: UpSetQuery<T>

      the query

    • what: keyof SetOverlap

      type of overlap

    • Optional toElemKey: (e: T) => string

      optional key function

        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns (s: ISetLike<T> | readonly T[]) => number

      • computes the overlap of the given set to this query

        Parameters

        • s: ISetLike<T> | readonly T[]

          the current set to evaluate

        Returns number

        at most s.cardinality

setElemIntersectionFactory

  • setElemIntersectionFactory<T>(a: Set<T> | readonly T[], toElemKey?: (e: T) => string): (b: Set<T> | readonly T[]) => readonly T[]
  • Type parameters

    • T

    Parameters

    • a: Set<T> | readonly T[]
    • Optional toElemKey: (e: T) => string
        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns (b: Set<T> | readonly T[]) => readonly T[]

      • (b: Set<T> | readonly T[]): readonly T[]
      • Parameters

        • b: Set<T> | readonly T[]

        Returns readonly T[]

setElemOverlap

  • setElemOverlap<T>(a: Set<T> | readonly T[], b: Set<T> | readonly T[], toElemKey?: (e: T) => string): SetElemOverlap<T>
  • Type parameters

    • T

    Parameters

    • a: Set<T> | readonly T[]
    • b: Set<T> | readonly T[]
    • Optional toElemKey: (e: T) => string
        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns SetElemOverlap<T>

setElemOverlapFactory

  • setElemOverlapFactory<T>(a: Set<T> | readonly T[], toElemKey?: (e: T) => string): (b: Set<T> | readonly T[]) => SetElemOverlap<T>
  • Type parameters

    • T

    Parameters

    • a: Set<T> | readonly T[]
    • Optional toElemKey: (e: T) => string
        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns (b: Set<T> | readonly T[]) => SetElemOverlap<T>

setOverlap

  • setOverlap<T>(a: Set<T> | readonly T[], b: Set<T> | readonly T[], toElemKey?: (e: T) => string): SetOverlap
  • Type parameters

    • T

    Parameters

    • a: Set<T> | readonly T[]
    • b: Set<T> | readonly T[]
    • Optional toElemKey: (e: T) => string
        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns SetOverlap

setOverlapFactory

  • setOverlapFactory<T>(a: Set<T> | readonly T[], toElemKey?: (e: T) => string): (b: Set<T> | readonly T[]) => SetOverlap
  • Type parameters

    • T

    Parameters

    • a: Set<T> | readonly T[]
    • Optional toElemKey: (e: T) => string
        • (e: T): string
        • Parameters

          • e: T

          Returns string

    Returns (b: Set<T> | readonly T[]) => SetOverlap

toDump

toIndicesArray

  • toIndicesArray<T>(arr: readonly T[], toIndex: (v: T) => number, __namedParameters?: { compress?: "no" | "yes" | "auto"; sortAble?: boolean }): string | readonly number[]
  • creates an (compressed) indices array for the given array of elements

    Type parameters

    • T

    Parameters

    • arr: readonly T[]

      the array to compress

    • toIndex: (v: T) => number

      the element to index function

        • (v: T): number
        • Parameters

          • v: T

          Returns number

    • __namedParameters: { compress?: "no" | "yes" | "auto"; sortAble?: boolean } = {}
      • Optional compress?: "no" | "yes" | "auto"
      • Optional sortAble?: boolean

    Returns string | readonly number[]

toKey

  • helper method to generate a key for a given set

    Parameters

    • s: ISetLike<any>

      the set to compute the key for

    Returns string

toStaticDump