Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataHelper

Various utility functions for transforming and processing data sets.

Hierarchy

  • DataHelper

Index

Methods

Static downsample

  • Downsamples data by reducing segments that scales to the same approximate range

    Parameters

    • datapoints: PlotData

      data to downsample

    • scale: Scale

      scale to control downsampling

    • Default value reducer: ReducerFunction = DataHelper.minmax

      function to reduce segments

    Returns PlotData

Static filterData

  • Cut data points that are outside the current visible domain. An excess will ensure that panning is smooth

    Parameters

    • datapoints: PlotData
    • domain: Domain
    • Default value overlapFactor: number = 0.5

    Returns PlotData

Static findNextDefined

  • findNextDefined(data: PlotData, start?: number): number
  • Find the first index that has a finite numeric value

    Parameters

    • data: PlotData

      data to search

    • Default value start: number = 0

      start index to search from

    Returns number

Static findNextUndefined

  • findNextUndefined(data: PlotData, start?: number): number
  • Find the first index that has NOT a finite numeric value

    Parameters

    • data: PlotData

      data to search

    • Default value start: number = 0

      start index to search from

    Returns number

Static isWithinBounds

Static mean

Static mergeDataSeries

Static minmax

Static queryContinuousData

  • queryContinuousData(queryVal: number, data: PlotData): number | null
  • In a data set of two values, return the second element of the item where the first item is closest to the query value. The data set is considered to be contineous rather than discrete.

    Parameters

    Returns number | null

Static queryPointData

  • queryPointData(queryVal: number, data: PlotData, threshold?: number): number | null
  • In a data set of two values, return the second element of the item where the first item is closest to the query value. The data set is considered to be discrete.

    Parameters

    • queryVal: number
    • data: PlotData
    • Default value threshold: number = 0

    Returns number | null

Static queryZoneData

  • queryZoneData(queryVal: number, data: PlotData): number | null
  • In a data set of two values, return the second element of the item where the first item is closest to the query value. The data set is considered to be organized such that an item is the end of the previous item and the start of the next (zones).

    Parameters

    Returns number | null

Static resample

  • Resample large data series to reduce detail when number of points are greater than the number of pixels to render it to. NOTE: you should pass the data through the DataHelper.trimUndefinedValues before passing it to this function. Also, this function assumes the datapoints are more or less uniformly spaced. The DataHelper.downsample is probably safer and yields better results.

    Parameters

    • datapoints: PlotData

      data to resample

    • ratio: number

      resample ratio

    • Default value reducer: ReducerFunction = DataHelper.mean

      function to reduce segments

    Returns PlotData

Static trimUndefinedValues

  • Remove successive entries of NULL values, leaving only the first NULL value. Required by the resample function.

    Parameters

    Returns PlotData

Generated using TypeDoc