stream-charts
    Preparing search index...

    Function minMaxOf

    • Calculates the (min, max) of all the values (from the accessor) in the data matrix, clamped by the global (currentMin, currentMax).

      Curried function that accepts an accessor used to grab the value from the data point, and array of (x, y) values (each (x, y) value is represented as [number, number] tuple), and a global, current min and max values. The global, current min and max clamp the calculated min and max values.

      Type Parameters

      • T

      Parameters

      • accessor: (v: T) => number

        Access function that accepts a datum and returns the value which to use in the min-max calc

      Returns (data: T[][], currentMinMax: [number, number]) => [number, number]

      A function that accepts data (represented as a matrix of (x, y) pairs, where each row is a data series), a global currentMin and currentMax, which clamp the calculated results. The function return a tuple holding the min as the first value and the max as the second value.

      // function that calculates the min-max of the y-values generated by calling the minMaxOf and handing it the
      // accessor function that grabs the y-value from the datum
      const minMaxTimeSeriesY: (data: Array<TimeSeries>, currentMinMax: [number, number]) => [number, number] =
      minMaxOf((datum: [number, number]): number => datum[1])