Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "utils/index"

Index

Functions

Const downSample

  • Down sample points so that each line has the respective number of maxPoints

    Parameters

    • data: LineProps[]

      Data points

    • maxPoints: number

      the max number of points that should be dsiplayed for any line

    Returns Coordinate[][]

    The resulting filtered data points

Const getDomain

  • getDomain(xDomain: Domains["xDomain"], yDomain: Domains["yDomain"], data: CommonProps["data"]): { derivedXDomain: Domains["xDomain"]; derivedYDomain: Domains["yDomain"] }
  • Function that will calculate the x and y domains of a graph if not provided.

    • x lower bound: smallest x value
    • x upper bound: largest x value
    • y lower bound: -1 * largest absolute y value
    • y upper bound: largest absolute y value

    Parameters

    • xDomain: Domains["xDomain"]

      Optional user provided x axis domain

    • yDomain: Domains["yDomain"]

      Optional user provided y axis domain

    • data: CommonProps["data"]

      Data points

    Returns { derivedXDomain: Domains["xDomain"]; derivedYDomain: Domains["yDomain"] }

    • derivedXDomain: Calculated x axis domain
    • derivedYDomain: Caluclated y axis domain
    • derivedXDomain: Domains["xDomain"]
    • derivedYDomain: Domains["yDomain"]

Const getDomainHelper

  • getDomainHelper(data: CommonProps["data"], dimension: "x" | "y"): Domains["xDomain"]
  • Will return the smallest and largest values over any line for the given dimension

    Parameters

    • data: CommonProps["data"]

      Data points

    • dimension: "x" | "y"

      Calculate bounds for this dimension

    Returns Domains["xDomain"]

    The calculated lower and upper bounds for the given dimension and data points

Const getMatrixDomain

  • getMatrixDomain(matrix: Array<Array<number>>): [number, number]
  • Get matrix domain

    Parameters

    • matrix: Array<Array<number>>

    Returns [number, number]

Const googleColor20c

  • googleColor20c(n: number): string
  • Google Color 20c color getter

    Parameters

    • n: number

    Returns string

    string

Generated using TypeDoc