@types/d3-array

  • Version 2.12.1
  • Published
  • 52.5 kB
  • No dependencies
  • MIT license

Install

npm i @types/d3-array
yarn add @types/d3-array
pnpm add @types/d3-array

Overview

TypeScript definitions for D3JS d3-array module

Index

Variables

variable bisect

const bisect: {
(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
};

    Functions

    function ascending

    ascending: (a: Primitive | undefined, b: Primitive | undefined) => number;
    • Compares two primitive values for sorting (in ascending order).

    function bin

    bin: {
    (): HistogramGeneratorNumber<number, number>;
    <Datum, Value extends number>(): HistogramGeneratorNumber<Datum, Value>;
    <Datum, Value extends Date>(): HistogramGeneratorDate<Datum, Value>;
    };

      function bisectCenter

      bisectCenter: {
      (array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
      (array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
      (array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
      };

        function bisectLeft

        bisectLeft: {
        (array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
        (array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
        (array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
        };

          function bisector

          bisector: {
          <T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>;
          <T, U>(accessor: (x: T) => U): Bisector<T, U>;
          };

            function bisectRight

            bisectRight: {
            (array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
            (array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
            (array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
            };

              function count

              count: {
              <TObject>(iterable: Iterable<TObject>): number;
              <TObject>(
              iterable: Iterable<TObject>,
              accessor: (a: TObject, b: TObject) => number
              ): number;
              };
              • Returns the number of valid number values (i.e., not null, NaN, or undefined) in the specified iterable; accepts an accessor.

                Parameter iterable

                Input array.

              • Returns the number of valid number values (i.e., not null, NaN, or undefined) in the specified iterable; accepts an accessor.

                Parameter iterable

                Input array.

                Parameter accessor

                Accessor method.

              function cross

              cross: {
              <S, T>(a: Iterable<S>, b: Iterable<T>): Array<[S, T]>;
              <S, T, U>(a: Iterable<S>, b: Iterable<T>, reducer: (a: S, b: T) => U): U[];
              };
              • Returns the Cartesian product of the two arrays a and b. For each element i in the specified array a and each element j in the specified array b, in order, it creates a two-element array for each pair.

                Parameter a

                First input array.

                Parameter b

                Second input array.

              • Returns the Cartesian product of the two arrays a and b. For each element i in the specified array a and each element j in the specified array b, in order, invokes the specified reducer function passing the element i and element j.

                Parameter a

                First input array.

                Parameter b

                Second input array.

                Parameter reducer

                A reducer function taking as input an element from "a" and "b" and returning a reduced value.

              function cumsum

              cumsum: {
              (iterable: Iterable<Numeric | undefined | null>): Float64Array;
              <T>(
              iterable: Iterable<T>,
              accessor: (element: T, i: number, array: Iterable<T>) => number
              ): Float64Array;
              };
              • Returns the cumulative sum of the given iterable of numbers, as a Float64Array of the same length. If the iterable contains no numbers, returns zeros. An optional accessor function may be specified, which is equivalent to calling Array.from before computing the cumulative sum. This method ignores undefined and NaN values; this is useful for ignoring missing data.

              function descending

              descending: (a: Primitive | undefined, b: Primitive | undefined) => number;
              • Compares two primitive values for sorting (in descending order).

              function deviation

              deviation: {
              <T extends Numeric>(iterable: Iterable<T | undefined | null>):
              | number
              | undefined;
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => number
              ): number;
              };
              • Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers.

              • Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array, using the given accessor to convert values to numbers.

              function difference

              difference: <T>(iterable: Iterable<T>, ...others: Array<Iterable<T>>) => Set<T>;
              • Returns a new Set containing every value in iterable that is not in any of the others iterables.

              function disjoint

              disjoint: <T>(a: Iterable<T>, b: Iterable<T>) => boolean;
              • Returns true if a and b are disjoint: if a and b contain no shared value.

              function every

              every: <T>(
              iterable: Iterable<T>,
              test: (value: T, index: number, iterable: Iterable<T>) => unknown
              ) => boolean;
              • Returns true if the given test function returns true for every value in the given iterable. This method returns as soon as test returns a non-truthy value or all values are iterated over. Equivalent to array.every.

              function extent

              extent: {
              (iterable: Iterable<string>): [string, string] | [undefined, undefined];
              <T extends Numeric>(iterable: Iterable<T>): [undefined, undefined] | [T, T];
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => string
              ): [string, string] | [undefined, undefined];
              <T, U extends Numeric>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => U
              ): [undefined, undefined] | [U, U];
              };
              • Return the min and max simultaneously.

              function fcumsum

              fcumsum: {
              (values: Iterable<Numeric | undefined | null>): Float64Array;
              <T>(
              values: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => number
              ): Float64Array;
              };
              • Returns a full precision cumulative sum of the given values. Although slower, d3.fcumsum can replace d3.cumsum when greater precision is needed. Uses d3.Adder.

              function filter

              filter: <T>(
              iterable: Iterable<T>,
              test: (value: T, index: number, iterable: Iterable<T>) => unknown
              ) => T[];
              • Returns a new array containing the values from iterable, in order, for which the given test function returns true. Equivalent to array.filter.

              function fsum

              fsum: {
              <T extends Numeric>(values: Iterable<T | undefined | null>): number;
              <T>(
              values: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => number
              ): number;
              };
              • Returns a full precision summation of the given values. Although slower, d3.fsum can replace d3.sum wherever greater precision is needed. Uses d3.Adder.

              function greatest

              greatest: {
              <T>(iterable: Iterable<T>): T | undefined;
              <T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): T;
              <T, U>(iterable: Iterable<T>, accessor: (a: T) => U): T;
              };
              • Returns the greatest element of the specified iterable according to the specified comparator or accessor. If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns undefined. If comparator is not specified, it defaults to ascending.

              function greatestIndex

              greatestIndex: {
              <T>(iterable: Iterable<T>): number | undefined;
              <T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): number;
              <T, U>(iterable: Iterable<T>, accessor: (a: T) => U): number;
              };
              • Returns the index of the greatest element of the specified iterable according to the specified comparator or accessor. If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns -1. If comparator is not specified, it defaults to ascending.

              function group

              group: {
              <TObject, TKey>(
              iterable: Iterable<TObject>,
              key: (value: TObject) => TKey
              ): InternMap<TKey, TObject[]>;
              <TObject, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): InternMap<TKey1, Map<TKey2, TObject[]>>;
              <TObject, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): InternMap<TKey1, Map<TKey2, Map<TKey3, TObject[]>>>;
              };
              • Groups the specified array of values into an InternMap from key to array of value.

                Parameter iterable

                The array to group.

                Parameter key

                The key function.

              • Groups the specified array of values into an InternMap from key to array of value.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Groups the specified array of values into an InternMap from key to array of value.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function groups

              groups: {
              <TObject, TKey>(
              iterable: Iterable<TObject>,
              key: (value: TObject) => TKey
              ): Array<[TKey, TObject[]]>;
              <TObject, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): [TKey1, [TKey2, TObject[]][]][];
              <TObject, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): [TKey1, [TKey2, [TKey3, TObject[]][]][]][];
              };
              • Equivalent to group, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key

                The key function.

              • Equivalent to group, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Equivalent to group, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function groupSort

              groupSort: {
              <TObject, TKey>(
              iterable: Iterable<TObject>,
              comparator: (a: TObject[], b: TObject[]) => number,
              key: (value: TObject) => TKey
              ): TKey[];
              <TObject, TReduce, TKey>(
              iterable: Iterable<TObject>,
              accessor: (value: TObject[]) => TReduce,
              key: (value: TObject) => TKey
              ): TKey[];
              };
              • Groups the specified iterable of elements according to the specified key function, sorts the groups according to the specified comparator, and then returns an array of keys in sorted order. The comparator will be asked to compare two groups a and b and should return a negative value if a should be before b, a positive value if a should be after b, or zero for a partial ordering.

              • Groups the specified iterable of elements according to the specified key function, sorts the groups according to the specified accessor, and then returns an array of keys in sorted order.

              function histogram

              histogram: {
              (): HistogramGeneratorNumber<number, number>;
              <Datum, Value extends number>(): HistogramGeneratorNumber<Datum, Value>;
              <Datum, Value extends Date>(): HistogramGeneratorDate<Datum, Value>;
              };
              • @deprecated. Use bin instead.

              • Deprecated

                Use bin instead.

              function index

              index: {
              <TObject, TKey>(
              iterable: Iterable<TObject>,
              key: (value: TObject) => TKey
              ): InternMap<TKey, TObject>;
              <TObject, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): InternMap<TKey1, InternMap<TKey2, TObject>>;
              <TObject, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): InternMap<TKey1, InternMap<TKey2, InternMap<TKey3, TObject>>>;
              };
              • Equivalent to group but returns a unique value per compound key instead of an array, throwing if the key is not unique.

                Parameter iterable

                The array to group.

                Parameter key

                The key function.

              • Equivalent to group but returns a unique value per compound key instead of an array, throwing if the key is not unique.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Equivalent to group but returns a unique value per compound key instead of an array, throwing if the key is not unique.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function indexes

              indexes: {
              <TObject, TKey>(
              iterable: Iterable<TObject>,
              key: (value: TObject) => TKey
              ): Array<[TKey, TObject]>;
              <TObject, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): [TKey1, [TKey2, TObject][]][];
              <TObject, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): [TKey1, [TKey2, [TKey3, TObject][]][]][];
              };
              • Equivalent to index, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key

                The key function.

              • Equivalent to index, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Equivalent to index, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function intersection

              intersection: <T>(...iterables: Array<Iterable<T>>) => Set<T>;
              • Returns a new Set containing every (distinct) value that appears in all of the given iterables. The order of values in the returned Set is based on their first occurrence in the given iterables.

              function least

              least: {
              <T>(iterable: Iterable<T>): T | undefined;
              <T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): T;
              <T, U>(iterable: Iterable<T>, accessor: (a: T) => U): T;
              };
              • Returns the least element of the specified iterable.

              • Returns the least element of the specified iterable according to the specified comparator.

              • Returns the least element of the specified iterable according to the specified accessor.

              function leastIndex

              leastIndex: {
              <T>(iterable: Iterable<T>): number | undefined;
              <T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): number;
              <T, U>(iterable: Iterable<T>, accessor: (a: T) => U): number;
              };
              • Returns the index of the least element of the specified iterable according to the specified comparator.

              • Returns the index of the least element of the specified iterable according to the specified accessor.

              function map

              map: <T, U>(
              iterable: Iterable<T>,
              mapper: (value: T, index: number, iterable: Iterable<T>) => U
              ) => U[];
              • Returns a new array containing the mapped values from iterable, in order, as defined by given mapper function. Equivalent to array.map and Array.from.

              function max

              max: {
              (iterable: Iterable<string>): string | undefined;
              <T extends Numeric>(iterable: Iterable<T>): T;
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => string
              ): string;
              <T, U extends Numeric>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => U
              ): U;
              };
              • Return the maximum value in the array of strings using natural order.

              • Return the maximum value in the array of numbers using natural order.

              • Return the maximum value in the array using natural order and a projection function to map values to strings.

              • Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values.

              function maxIndex

              maxIndex: {
              <T>(iterable: Iterable<T>): number;
              <TDatum, U>(
              iterable: Iterable<TDatum>,
              accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => U
              ): number;
              };
              • Return the index of the maximum value in the array using natural order.

              • Return the index of the maximum value in the array using natural order and a projection function to map values.

              function mean

              mean: {
              <T extends Numeric>(iterable: Iterable<T | undefined | null>):
              | number
              | undefined;
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => number
              ): number;
              };
              • Return the mean of an array of numbers

              function median

              median: {
              <T extends Numeric>(iterable: Iterable<T | undefined | null>):
              | number
              | undefined;
              <T>(
              iterable: Iterable<T>,
              accessor: (element: T, i: number, array: Iterable<T>) => number
              ): number;
              };
              • Return the median of an array of numbers

              function merge

              merge: <T>(iterables: Iterable<Iterable<T>>) => T[];
              • Merges the specified arrays into a single array.

              function min

              min: {
              (iterable: Iterable<string>): string | undefined;
              <T extends Numeric>(iterable: Iterable<T>): T;
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => string
              ): string;
              <T, U extends Numeric>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => U
              ): U;
              };
              • Return the minimum value in the array using natural order.

              function minIndex

              minIndex: {
              <T>(iterable: Iterable<T>): number;
              <TDatum, U>(
              iterable: Iterable<TDatum>,
              accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => U
              ): number;
              <T>(iterable: Iterable<T>): number;
              };
              • Return the index of the minimum value in the array using natural order.

              • Return the index of the minimum value in the array using natural order and a projection function to map values.

              function nice

              nice: (start: number, stop: number, count: number) => [number, number];
              • Returns a new interval [niceStart, niceStop] covering the given interval [start, stop] and where niceStart and niceStop are guaranteed to align with the corresponding tick step. Like d3.tickIncrement, this requires that start is less than or equal to stop.

                Parameter start

                Start value for ticks

                Parameter stop

                Stop value for ticks

                Parameter count

                count + 1 is the approximate number of ticks to be returned by d3.ticks.

              function pairs

              pairs: {
              <T>(iterable: Iterable<T>): Array<[T, T]>;
              <T, U>(iterable: Iterable<T>, reducer: (a: T, b: T) => U): U[];
              };
              • For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. Returns the empty array if the input array has fewer than two elements.

                Parameter iterable

                Array of input elements

              • For each adjacent pair of elements in the specified array, in order, invokes the specified reducer function passing the element i and element i - 1. Returns the resulting array of pair-wise reduced elements. Returns the empty array if the input array has fewer than two elements.

                Parameter iterable

                Array of input elements

                Parameter reducer

                A reducer function taking as input to adjacent elements of the input array and returning a reduced value.

              function permute

              permute: {
              <T>(source: { [key: number]: T }, keys: Iterable<number>): T[];
              <T, K extends keyof T>(source: T, keys: Iterable<K>): T[K][];
              };
              • Returns a permutation of the specified source object (or array) using the specified iterable of keys. The returned array contains the corresponding property of the source object for each key in keys, in order. For example, permute(["a", "b", "c"], [1, 2, 0]) // ["b", "c", "a"]

                It is acceptable to have more keys than source elements, and for keys to be duplicated or omitted.

              • Extract the values from an object into an array with a stable order. For example: var object = {yield: 27, year: 1931, site: "University Farm"}; d3.permute(object, ["site", "yield"]); // ["University Farm", 27]

              function quantile

              quantile: {
              <T extends Numeric>(iterable: Iterable<T | undefined | null>, p: number):
              | number
              | undefined;
              <T>(
              iterable: Iterable<T>,
              p: number,
              accessor: (element: T, i: number, array: Iterable<T>) => number
              ): number;
              };
              • Returns the p-quantile of the given iterable of numbers, where p is a number in the range [0, 1].

                An optional accessor function may be specified, which is equivalent to calling array.map(accessor) before computing the quantile.

              function quantileSorted

              quantileSorted: {
              <T extends Numeric>(array: Array<T | undefined | null>, p: number):
              | number
              | undefined;
              <T>(
              array: T[],
              p: number,
              accessor: (element: T, i: number, array: T[]) => number
              ): number;
              };
              • Similar to quantile, but expects the input to be a sorted array of values. In contrast with quantile, the accessor is only called on the elements needed to compute the quantile.

              function quickselect

              quickselect: {
              <T>(array: ArrayLike<T>, k: number): T[];
              <T>(array: ArrayLike<T>, k: number, left: number): T[];
              <T>(array: ArrayLike<T>, k: number, left: number, right: number): T[];
              <T>(
              array: ArrayLike<T>,
              k: number,
              left: number,
              right: number,
              compare: (a: Primitive, b: Primitive) => number
              ): T[];
              };
              • Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

                Parameter array

                The array to partially sort (in place).

                Parameter k

                The middle index for partial sorting.

              • Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

                Parameter array

                The array to partially sort (in place).

                Parameter k

                The middle index for partial sorting.

                Parameter left

                The left index of the range to sort.

              • Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

                Parameter array

                The array to partially sort (in place).

                Parameter k

                The middle index for partial sorting.

                Parameter left

                The left index of the range to sort.

                Parameter right

                The right index.

              • Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

                Parameter array

                The array to partially sort (in place).

                Parameter k

                The middle index for partial sorting.

                Parameter left

                The left index of the range to sort.

                Parameter right

                The right index.

                Parameter compare

                The compare function.

              function range

              range: {
              (stop: number): number[];
              (start: number, stop: number, step?: number): number[];
              };
              • Generates a 0-based numeric sequence. The output range does not include 'stop'.

              • Generates a numeric sequence starting from the given start and stop values. 'step' defaults to 1. The output range does not include 'stop'.

              function reduce

              reduce: {
              <T>(
              iterable: Iterable<T>,
              reducer: (
              previousValue: T,
              currentValue: T,
              currentIndex: number,
              iterable: Iterable<T>
              ) => T,
              initialValue?: T
              ): T;
              <T, U>(
              iterable: Iterable<T>,
              reducer: (
              previousValue: U,
              currentValue: T,
              currentIndex: number,
              iterable: Iterable<T>
              ) => U,
              initialValue: U
              ): U;
              };
              • Returns the reduced value defined by given reducer function, which is repeatedly invoked for each value in iterable, being passed the current reduced value and the next value. Equivalent to array.reduce.

              function reverse

              reverse: <T>(iterable: Iterable<T>) => T[];
              • Returns an array containing the values in the given iterable in reverse order. Equivalent to array.reverse, except that it does not mutate the given iterable.

              function rollup

              rollup: {
              <TObject, TReduce, TKey>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key: (value: TObject) => TKey
              ): InternMap<TKey, TReduce>;
              <TObject, TReduce, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): InternMap<TKey1, InternMap<TKey2, TReduce>>;
              <TObject, TReduce, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): InternMap<TKey1, InternMap<TKey2, InternMap<TKey3, TReduce>>>;
              };
              • Groups and reduces the specified array of values into an InternMap from key to value.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key

                The key function.

              • Groups and reduces the specified array of values into an InternMap from key to value.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Groups and reduces the specified array of values into an InternMap from key to value.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function rollups

              rollups: {
              <TObject, TReduce, TKey>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key: (value: TObject) => TKey
              ): Array<[TKey, TReduce]>;
              <TObject, TReduce, TKey1, TKey2>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2
              ): [TKey1, [TKey2, TReduce][]][];
              <TObject, TReduce, TKey1, TKey2, TKey3>(
              iterable: Iterable<TObject>,
              reduce: (value: TObject[]) => TReduce,
              key1: (value: TObject) => TKey1,
              key2: (value: TObject) => TKey2,
              key3: (value: TObject) => TKey3
              ): [TKey1, [TKey2, [TKey3, TReduce][]][]][];
              };
              • Equivalent to rollup, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key

                The key function.

              • Equivalent to rollup, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

              • Equivalent to rollup, but returns nested arrays instead of nested maps.

                Parameter iterable

                The array to group.

                Parameter reduce

                The reduce function.

                Parameter key1

                The first key function.

                Parameter key2

                The second key function.

                Parameter key3

                The third key function.

              function shuffle

              shuffle: {
              <T>(array: T[], lo?: number, hi?: number): T[];
              (array: Int8Array, lo?: number, hi?: number): Int8Array;
              (array: Uint8Array, lo?: number, hi?: number): Uint8Array;
              (array: Uint8ClampedArray, lo?: number, hi?: number): Uint8ClampedArray;
              (array: Int16Array, lo?: number, hi?: number): Int16Array;
              (array: Uint16Array, lo?: number, hi?: number): Uint16Array;
              (array: Int32Array, lo?: number, hi?: number): Int32Array;
              (array: Uint32Array, lo?: number, hi?: number): Uint32Array;
              (array: Float32Array, lo?: number, hi?: number): Float32Array;
              (array: Float64Array, lo?: number, hi?: number): Float64Array;
              };
              • Randomizes the order of the specified array using the Fisher–Yates shuffle.

              function shuffler

              shuffler: (random: () => number) => typeof shuffle;
              • Returns a shuffle function given the specified random source.

              function some

              some: <T>(
              iterable: Iterable<T>,
              test: (value: T, index: number, iterable: Iterable<T>) => unknown
              ) => boolean;
              • Returns true if the given test function returns true for any value in the given iterable. This method returns as soon as test returns a truthy value or all values are iterated over. Equivalent to array.some.

              function sort

              sort: {
              <T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T[];
              <T>(iterable: Iterable<T>, ...accessors: ((a: T) => unknown)[]): T[];
              };
              • Returns an array containing the values in the given iterable in the sorted order defined by the given comparator function. If comparator is not specified, it defaults to d3.ascending. Equivalent to array.sort, except that it does not mutate the given iterable, and the comparator defaults to natural order instead of lexicographic order.

              • Returns an array containing the values in the given iterable in the sorted order defined by the given accessor function. This is equivalent to a comparator using natural order. The accessor is only invoked once per element, and thus may be nondeterministic. Multiple accessors may be specified to break ties.

              function subset

              subset: <T>(a: Iterable<T>, b: Iterable<T>) => boolean;
              • Returns true if a is a subset of b: if every value in the given iterable a is also in the given iterable b.

              function sum

              sum: {
              <T extends Numeric>(iterable: Iterable<T | undefined | null>): number;
              <T>(
              iterable: Iterable<T>,
              accessor: (datum: T, index: number, array: Iterable<T>) => number
              ): number;
              };
              • Compute the sum of an array of numbers.

              • Compute the sum of an array, using the given accessor to convert values to numbers.

              function superset

              superset: <T>(a: Iterable<T>, b: Iterable<T>) => boolean;
              • Returns true if a is a superset of b: if every value in the given iterable b is also in the given iterable a.

              function thresholdFreedmanDiaconis

              thresholdFreedmanDiaconis: (
              values: ArrayLike<number | undefined>,
              min: number,
              max: number
              ) => number;

                function thresholdScott

                thresholdScott: (
                values: ArrayLike<number | undefined>,
                min: number,
                max: number
                ) => number;

                  function thresholdSturges

                  thresholdSturges: (values: ArrayLike<number | undefined>) => number;

                    function tickIncrement

                    tickIncrement: (start: number, stop: number, count: number) => number;
                    • Returns the difference between adjacent tick values if the same arguments were passed to d3.ticks: a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5.

                      Like d3.tickStep, except requires that start is always less than or equal to stop, and if the tick step for the given start, stop and count would be less than one, returns the negative inverse tick step instead.

                      This method is always guaranteed to return an integer, and is used by d3.ticks to avoid guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point.

                      Parameter start

                      Start value for ticks

                      Parameter stop

                      Stop value for ticks

                      Parameter count

                      count + 1 is the approximate number of ticks to be returned by d3.ticks.

                    function ticks

                    ticks: (start: number, stop: number, count: number) => number[];
                    • Generate an array of approximately count + 1 uniformly-spaced, nicely-rounded values between start and stop (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. See also d3.tickIncrement, d3.tickStep and linear.ticks.

                      Ticks are inclusive in the sense that they may include the specified start and stop values if (and only if) they are exact, nicely-rounded values consistent with the inferred step. More formally, each returned tick t satisfies start ≤ t and t ≤ stop.

                      Parameter start

                      Start value for ticks

                      Parameter stop

                      Stop value for ticks

                      Parameter count

                      count + 1 is the approximate number of ticks to be returned by d3.ticks.

                    function tickStep

                    tickStep: (start: number, stop: number, count: number) => number;
                    • Returns the difference between adjacent tick values if the same arguments were passed to d3.ticks: a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5.

                      Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; use d3-format to format numbers for human consumption.

                      Parameter start

                      Start value for ticks

                      Parameter stop

                      Stop value for ticks

                      Parameter count

                      count + 1 is the approximate number of ticks to be returned by d3.ticks.

                    function transpose

                    transpose: <T>(matrix: ArrayLike<ArrayLike<T>>) => T[][];
                    • Transpose a matrix provided in Array of Arrays format.

                    function union

                    union: <T>(...iterables: Array<Iterable<T>>) => Set<T>;
                    • Returns a new Set containing every (distinct) value that appears in any of the given iterables. The order of values in the returned Set is based on their first occurrence in the given iterables.

                    function variance

                    variance: {
                    <T extends Numeric>(iterable: Iterable<T | undefined | null>):
                    | number
                    | undefined;
                    <T>(
                    iterable: Iterable<T>,
                    accessor: (datum: T, index: number, array: Iterable<T>) => number
                    ): number;
                    };
                    • Returns an unbiased estimator of the population variance of the given iterable of numbers using Welford’s algorithm. If the iterable has fewer than two numbers, returns undefined. An optional accessor function may be specified, which is equivalent to calling Array.from before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data.

                    function zip

                    zip: <T>(...arrays: Array<ArrayLike<T>>) => T[][];
                    • Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays. The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array contains one-element arrays. With no arguments, the returned array is empty.

                    Classes

                    class Adder

                    class Adder {}

                      constructor

                      constructor();
                      • Creates a full precision adder for IEEE 754 floating point numbers, setting its initial value to 0.

                      method add

                      add: (number: number) => Adder;
                      • Adds the specified number to the adder’s current value and returns the adder.

                      method valueOf

                      valueOf: () => number;
                      • Returns the IEEE 754 double precision representation of the adder’s current value. Most useful as the short-hand notation +adder.

                      class InternMap

                      class InternMap<K = any, V = any> extends Map<K, V> {}
                      • The InternMap class extends the native JavaScript Map class, allowing Dates and other non-primitive keys by bypassing the SameValueZero algorithm when determining key equality.

                      class InternSet

                      class InternSet<T = any> extends Set<T> {}
                      • The InternSet class extends the native JavaScript Set class, allowing Dates and other non-primitive keys by bypassing the SameValueZero algorithm when determining key equality.

                      Interfaces

                      interface Bin

                      interface Bin<Datum, Value extends number | Date | undefined> extends Array<Datum> {}

                        property x0

                        x0: Value | undefined;

                          property x1

                          x1: Value | undefined;

                            interface Bisector

                            interface Bisector<T, U> {}

                              method center

                              center: (array: ArrayLike<T>, x: U, lo?: number, hi?: number) => number;

                                method left

                                left: (array: ArrayLike<T>, x: U, lo?: number, hi?: number) => number;

                                  method right

                                  right: (array: ArrayLike<T>, x: U, lo?: number, hi?: number) => number;

                                    interface HistogramCommon

                                    interface HistogramCommon<Datum, Value extends number | Date | undefined> {}

                                      method value

                                      value: {
                                      (): (d: Datum, i: number, data: ArrayLike<Datum>) => Value;
                                      (
                                      valueAccessor: (d: Datum, i: number, data: ArrayLike<Datum>) => Value
                                      ): this;
                                      };

                                        call signature

                                        (data: ArrayLike<Datum>): Array<Bin<Datum, Value>>;

                                          interface HistogramGeneratorDate

                                          interface HistogramGeneratorDate<Datum, Value extends Date | undefined>
                                          extends HistogramCommon<Datum, Date> {}

                                            method domain

                                            domain: {
                                            (): (values: ArrayLike<Value>) => [Date, Date];
                                            (domain: [Date, Date]): this;
                                            (domainAccessor: (values: ArrayLike<Value>) => [Date, Date]): this;
                                            };

                                              method thresholds

                                              thresholds: {
                                              (): ThresholdDateArrayGenerator<Value>;
                                              (thresholds: ArrayLike<Value>): this;
                                              (thresholds: ThresholdDateArrayGenerator<Value>): this;
                                              };
                                              • Set the array of values to be used as thresholds in determining the bins.

                                                Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                Parameter thresholds

                                                Array of threshold values used for binning. The elements must be of the same type as the materialized values of the histogram.

                                              • Set a threshold accessor function, which returns the array of values to be used as thresholds in determining the bins.

                                                Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                Parameter thresholds

                                                A function which accepts as arguments the array of materialized values, and optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as thresholds in determining the bins.

                                              interface HistogramGeneratorNumber

                                              interface HistogramGeneratorNumber<Datum, Value extends number | undefined>
                                              extends HistogramCommon<Datum, Value> {}

                                                method domain

                                                domain: {
                                                (): (values: Iterable<Value>) => [number, number] | [undefined, undefined];
                                                (domain: [number, number]): this;
                                                (
                                                domainAccessor: (
                                                values: Iterable<Value>
                                                ) => [undefined, undefined] | [number, number]
                                                ): this;
                                                };

                                                  method thresholds

                                                  thresholds: {
                                                  (): ThresholdCountGenerator<Value> | ThresholdNumberArrayGenerator<Value>;
                                                  (count: number): this;
                                                  (count: ThresholdCountGenerator<Value>): this;
                                                  (thresholds: ArrayLike<Value>): this;
                                                  (thresholds: ThresholdNumberArrayGenerator<Value>): this;
                                                  };
                                                  • Divide the domain uniformly into approximately count bins. IMPORTANT: This threshold setting approach only works, when the materialized values are numbers!

                                                    Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                    Parameter count

                                                    The desired number of uniform bins.

                                                  • Set a threshold accessor function, which returns the desired number of bins. Divides the domain uniformly into approximately count bins. IMPORTANT: This threshold setting approach only works, when the materialized values are numbers!

                                                    Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                    Parameter count

                                                    A function which accepts as arguments the array of materialized values, and optionally the domain minimum and maximum. The function calculates and returns the suggested number of bins.

                                                  • Set the array of values to be used as thresholds in determining the bins.

                                                    Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                    Parameter thresholds

                                                    Array of threshold values used for binning. The elements must be of the same type as the materialized values of the histogram.

                                                  • Set a threshold accessor function, which returns the array of values to be used as thresholds in determining the bins.

                                                    Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.

                                                    Parameter thresholds

                                                    A function which accepts as arguments the array of materialized values, and optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as thresholds in determining the bins.

                                                  interface Numeric

                                                  interface Numeric {}
                                                  • Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations

                                                  method valueOf

                                                  valueOf: () => number;

                                                    Type Aliases

                                                    type Primitive

                                                    type Primitive = number | string | boolean | Date;
                                                    • Administrivia: JavaScript primitive types and Date

                                                    type ThresholdCountGenerator

                                                    type ThresholdCountGenerator<
                                                    Value extends number | undefined = number | undefined
                                                    > = (values: ArrayLike<Value>, min: number, max: number) => number;
                                                    • Type definition for threshold generator which returns the count of recommended thresholds

                                                    type ThresholdDateArrayGenerator

                                                    type ThresholdDateArrayGenerator<Value extends Date | undefined> = (
                                                    values: ArrayLike<Value>,
                                                    min: Date,
                                                    max: Date
                                                    ) => Value[];
                                                    • Type definition for threshold generator which returns an array of recommended dates thresholds

                                                    type ThresholdNumberArrayGenerator

                                                    type ThresholdNumberArrayGenerator<Value extends number | undefined> = (
                                                    values: ArrayLike<Value>,
                                                    min: number,
                                                    max: number
                                                    ) => Value[];
                                                    • Type definition for threshold generator which returns an array of recommended numbers thresholds

                                                    Package Files (1)

                                                    Dependencies (0)

                                                    No dependencies.

                                                    Dev Dependencies (0)

                                                    No dev dependencies.

                                                    Peer Dependencies (0)

                                                    No peer dependencies.

                                                    Badge

                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/d3-array.

                                                    • Markdown
                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-array)
                                                    • HTML
                                                      <a href="https://www.jsdocs.io/package/@types/d3-array"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>