@types/d3-selection

  • Version 2.0.0
  • Published
  • 70.6 kB
  • No dependencies
  • MIT license

Install

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

Overview

TypeScript definitions for D3JS d3-selection module

Index

Variables

variable namespaces

const namespaces: NamespaceMap;
  • Map of namespace prefixes to corresponding fully qualified namespace strings

variable selection

const selection: SelectionFn;
  • Selects the root element, document.documentElement. This function can also be used to test for selections (instanceof d3.selection) or to extend the selection prototype.

Functions

function create

create: {
<
K extends
| 'symbol'
| 'circle'
| 'clipPath'
| 'defs'
| 'desc'
| 'ellipse'
| 'feBlend'
| 'feColorMatrix'
| 'feComponentTransfer'
| 'feComposite'
| 'feConvolveMatrix'
| 'feDiffuseLighting'
| 'feDisplacementMap'
| 'feDistantLight'
| 'feFlood'
| 'feFuncA'
| 'feFuncB'
| 'feFuncG'
| 'feFuncR'
| 'feGaussianBlur'
| 'feImage'
| 'feMerge'
| 'feMergeNode'
| 'feMorphology'
| 'feOffset'
| 'fePointLight'
| 'feSpecularLighting'
| 'feSpotLight'
| 'feTile'
| 'feTurbulence'
| 'filter'
| 'foreignObject'
| 'g'
| 'image'
| 'line'
| 'linearGradient'
| 'marker'
| 'mask'
| 'metadata'
| 'path'
| 'pattern'
| 'polygon'
| 'polyline'
| 'radialGradient'
| 'rect'
| 'stop'
| 'svg'
| 'switch'
| 'text'
| 'textPath'
| 'tspan'
| 'use'
| 'view'
| keyof HTMLElementTagNameMap
>(
name: K
): Selection<ElementTagNameMap[K], undefined, null, undefined>;
<NewGElement extends Element>(name: string): Selection<
NewGElement,
undefined,
null,
undefined
>;
};
  • Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.

    Parameter name

    tag name of the element to be added.

  • Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.

    Parameter name

    Tag name of the element to be added. See "namespace" for details on supported namespace prefixes, such as for SVG elements.

function creator

creator: {
<
K extends
| 'symbol'
| 'circle'
| 'clipPath'
| 'defs'
| 'desc'
| 'ellipse'
| 'feBlend'
| 'feColorMatrix'
| 'feComponentTransfer'
| 'feComposite'
| 'feConvolveMatrix'
| 'feDiffuseLighting'
| 'feDisplacementMap'
| 'feDistantLight'
| 'feFlood'
| 'feFuncA'
| 'feFuncB'
| 'feFuncG'
| 'feFuncR'
| 'feGaussianBlur'
| 'feImage'
| 'feMerge'
| 'feMergeNode'
| 'feMorphology'
| 'feOffset'
| 'fePointLight'
| 'feSpecularLighting'
| 'feSpotLight'
| 'feTile'
| 'feTurbulence'
| 'filter'
| 'foreignObject'
| 'g'
| 'image'
| 'line'
| 'linearGradient'
| 'marker'
| 'mask'
| 'metadata'
| 'path'
| 'pattern'
| 'polygon'
| 'polyline'
| 'radialGradient'
| 'rect'
| 'stop'
| 'svg'
| 'switch'
| 'text'
| 'textPath'
| 'tspan'
| 'use'
| 'view'
| keyof HTMLElementTagNameMap
>(
name: K
): (this: BaseType) => ElementTagNameMap[K];
<NewGElement extends Element>(name: string): (this: BaseType) => NewGElement;
};
  • Given the specified element name, returns a function which creates an element of the given name, assuming that "this" is the parent element.

    Parameter name

    Tag name of the element to be added.

  • Given the specified element name, returns a function which creates an element of the given name, assuming that "this" is the parent element.

    The generic refers to the type of the new element to be returned by the creator function.

    Parameter name

    Tag name of the element to be added. See "namespace" for details on supported namespace prefixes, such as for SVG elements.

function local

local: <T>() => Local<T>;
  • Obtain a new local variable

    The generic refers to the type of the variable to store locally.

function matcher

matcher: (selector: string) => (this: BaseType) => boolean;
  • Given the specified selector, returns a function which returns true if "this" element matches the specified selector.

    Parameter selector

    A CSS selector string.

function namespace

namespace: (prefixedLocal: string) => NamespaceLocalObject | string;
  • Obtain an object with properties of fully qualified namespace string and name of local by parsing a shorthand string "prefix:local". If the prefix does not exist in the "namespaces" object provided by d3-selection, then the local name is returned as a simple string.

    Parameter prefixedLocal

    A string composed of the namespace prefix and local name separated by colon, e.g. "svg:text".

function pointer

pointer: (event: any, target?: any) => [number, number];
  • Returns a two-element array of numbers [x, y] representing the coordinates of the specified event relative to the specified target. event can be a MouseEvent, a PointerEvent, a Touch, or a custom event holding a UIEvent as event.sourceEvent.

    If target is not specified, it defaults to the source event’s currentTarget property, if available. If the target is an SVG element, the event’s coordinates are transformed using the inverse of the screen coordinate transformation matrix. If the target is an HTML element, the event’s coordinates are translated relative to the top-left corner of the target’s bounding client rectangle. (As such, the coordinate system can only be translated relative to the client coordinates. See also GeometryUtils.) Otherwise, [event.pageX, event.pageY] is returned.

    Parameter event

    The specified event.

    Parameter target

    The target which the coordinates are relative to.

function pointers

pointers: (event: any, target?: any) => Array<[number, number]>;
  • Returns an array [[x0, y0], [x1, y1]…] of coordinates of the specified event’s pointer locations relative to the specified target. For touch events, the returned array of positions corresponds to the event.touches array; for other events, returns a single-element array.

    If target is not specified, it defaults to the source event’s currentTarget property, if any.

    Parameter event

    The specified event.

    Parameter target

    The target which the coordinates are relative to.

function select

select: {
<GElement extends BaseType, OldDatum>(selector: string): Selection<
GElement,
OldDatum,
HTMLElement,
any
>;
<GElement extends BaseType, OldDatum>(node: GElement): Selection<
GElement,
OldDatum,
null,
undefined
>;
};
  • Select the first element that matches the specified selector string. If no elements match the selector, returns an empty selection. If multiple elements match the selector, only the first matching element (in document order) will be selected.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.

    Parameter selector

    CSS selector string

  • Select the specified node element.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.

    Parameter node

    An element to be selected

function selectAll

selectAll: {
(): Selection<null, undefined, null, undefined>;
(selector: null): Selection<null, undefined, null, undefined>;
(selector: undefined): Selection<null, undefined, null, undefined>;
<GElement extends BaseType, OldDatum>(selector: string): Selection<
GElement,
OldDatum,
HTMLElement,
any
>;
<GElement extends BaseType, OldDatum>(
nodes: GElement[] | ArrayLike<GElement> | Iterable<GElement>
): Selection<GElement, OldDatum, null, undefined>;
};
  • Create an empty selection.

  • Select all elements that match the specified selector string. The elements will be selected in document order (top-to-bottom). If no elements in the document match the selector, returns an empty selection.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.

    Parameter selector

    CSS selector string

  • Select the specified array, array-like, or iterable of nodes. This is useful if you already have a reference to nodes, such as this.childNodes within an event listener or a global such as document.links. The nodes may instead be an iterable, or a pseudo-array such as a NodeList.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, of a selected element.

    Parameter nodes

    An array, array-like, or iterable of nodes

function selector

selector: <DescElement extends Element>(
selector: string
) => (this: BaseType) => DescElement;
  • Given the specified selector, returns a function which returns the first descendant of "this" element that matches the specified selector.

    The generic refers to the type of the returned descendant element.

    Parameter selector

    A CSS selector string.

function selectorAll

selectorAll: <DescElement extends Element>(
selector: string
) => (this: BaseType) => NodeListOf<DescElement>;
  • Given the specified selector, returns a function which returns all descendants of "this" element that match the specified selector.

    The generic refers to the type of the returned descendant element.

    Parameter selector

    A CSS selector string.

function style

style: (node: Element, name: string) => string;
  • Returns the value of the style property with the specified name for the specified node. If the node has an inline style with the specified name, its value is returned; otherwise, the computed property value is returned. See also selection.style.

    Parameter node

    A DOM node (e.g. HTMLElement, SVGElement) for which to retrieve the style property.

    Parameter name

    Style property name.

function window

window: (DOMNode: Window | Document | Element) => Window;
  • Returns the owner window for the specified node. If node is a node, returns the owner document’s default view; if node is a document, returns its default view; otherwise returns the node.

    Parameter DOMNode

    A DOM element

Interfaces

interface ArrayLike

interface ArrayLike<T> {}
  • A helper interface which covers arguments like NodeListOf or HTMLCollectionOf argument types

property length

length: number;

    method item

    item: (index: number) => T | null;

      index signature

      [index: number]: T;

        interface ClientPointEvent

        interface ClientPointEvent {}
        • A User interface event (e.g. mouse event, touch or MSGestureEvent) with captured clientX and clientY properties.

        property clientX

        clientX: number;

          property clientY

          clientY: number;

            interface CustomEventParameters

            interface CustomEventParameters {}
            • Interface for optional parameters map, when dispatching custom events on a selection

            property bubbles

            bubbles: boolean;
            • If true, the event is dispatched to ancestors in reverse tree order

            property cancelable

            cancelable: boolean;
            • If true, event.preventDefault is allowed

            property detail

            detail: any;
            • Any custom data associated with the event

            interface EnterElement

            interface EnterElement {}
            • An interface describing the element type of the Enter Selection group elements created when invoking selection.enter().

            property namespaceURI

            namespaceURI: string;

              property ownerDocument

              ownerDocument: Document;

                method appendChild

                appendChild: (newChild: Node) => Node;

                  method insertBefore

                  insertBefore: (newChild: Node, refChild: Node) => Node;

                    method querySelector

                    querySelector: (selectors: string) => Element;

                      method querySelectorAll

                      querySelectorAll: (selectors: string) => NodeListOf<Element>;

                        interface Local

                        interface Local<T> {}

                          method get

                          get: (node: Element) => T | undefined;
                          • Retrieves a local variable stored on the node (or one of its parents).

                            Parameter node

                            A node element.

                          method remove

                          remove: (node: Element) => boolean;
                          • Deletes the value associated with the given node. Values stored on ancestors are not affected, meaning that child nodes will still see inherited values.

                            This function returns true if there was a value stored directly on the node, and false otherwise.

                            Parameter node

                            A node element.

                          method set

                          set: (node: Element, value: T) => Element;
                          • Store a value for this local variable. Calling .get() on children of this node will also retrieve the variable's value.

                            Parameter node

                            A node element.

                            Parameter value

                            Value to store locally

                          method toString

                          toString: () => string;
                          • Obtain a string with the internally assigned property name for the local which is used to store the value on a node

                          interface NamespaceLocalObject

                          interface NamespaceLocalObject {}
                          • Interface for object literal containing local name with related fully qualified namespace

                          property local

                          local: string;
                          • Name of the local to be namespaced.

                          property space

                          space: string;
                          • Fully qualified namespace

                          interface NamespaceMap

                          interface NamespaceMap {}
                          • Interface for maps of namespace prefixes to corresponding fully qualified namespace strings

                          index signature

                          [prefix: string]: string;

                            interface Selection

                            interface Selection<
                            GElement extends BaseType,
                            Datum,
                            PElement extends BaseType,
                            PDatum
                            > {}
                            • A D3 Selection of elements.

                              The first generic "GElement" refers to the type of the selected element(s). The second generic "Datum" refers to the type of the datum of a selected element(s). The third generic "PElement" refers to the type of the parent element(s) in the D3 selection. The fourth generic "PDatum" refers to the type of the datum of the parent element(s).

                            method [Symbol.iterator]

                            [Symbol.iterator]: () => Iterator<GElement>;
                            • Returns an iterator over the selected (non-null) elements.

                            method append

                            append: {
                            <
                            K extends
                            | 'symbol'
                            | 'circle'
                            | 'clipPath'
                            | 'defs'
                            | 'desc'
                            | 'ellipse'
                            | 'feBlend'
                            | 'feColorMatrix'
                            | 'feComponentTransfer'
                            | 'feComposite'
                            | 'feConvolveMatrix'
                            | 'feDiffuseLighting'
                            | 'feDisplacementMap'
                            | 'feDistantLight'
                            | 'feFlood'
                            | 'feFuncA'
                            | 'feFuncB'
                            | 'feFuncG'
                            | 'feFuncR'
                            | 'feGaussianBlur'
                            | 'feImage'
                            | 'feMerge'
                            | 'feMergeNode'
                            | 'feMorphology'
                            | 'feOffset'
                            | 'fePointLight'
                            | 'feSpecularLighting'
                            | 'feSpotLight'
                            | 'feTile'
                            | 'feTurbulence'
                            | 'filter'
                            | 'foreignObject'
                            | 'g'
                            | 'image'
                            | 'line'
                            | 'linearGradient'
                            | 'marker'
                            | 'mask'
                            | 'metadata'
                            | 'path'
                            | 'pattern'
                            | 'polygon'
                            | 'polyline'
                            | 'radialGradient'
                            | 'rect'
                            | 'stop'
                            | 'svg'
                            | 'switch'
                            | 'text'
                            | 'textPath'
                            | 'tspan'
                            | 'use'
                            | 'view'
                            | keyof HTMLElementTagNameMap
                            >(
                            type: K
                            ): Selection<ElementTagNameMap[K], Datum, PElement, PDatum>;
                            <ChildElement extends BaseType>(type: string): Selection<
                            ChildElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            <ChildElement extends BaseType>(
                            type: ValueFn<GElement, Datum, ChildElement>
                            ): Selection<ChildElement, Datum, PElement, PDatum>;
                            };
                            • Appends a new element of this type (tag name) as the last child of each selected element, or before the next following sibling in the update selection if this is an enter selection. The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; however, note that selection.order may still be required if updating elements change order (i.e., if the order of new data is inconsistent with old data).

                              This method returns a new selection containing the appended elements. Each new element inherits the data of the current elements, if any.

                              Parameter type

                              A string representing the tag name.

                            • Appends a new element of this type (tag name) as the last child of each selected element, or before the next following sibling in the update selection if this is an enter selection. The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; however, note that selection.order may still be required if updating elements change order (i.e., if the order of new data is inconsistent with old data).

                              This method returns a new selection containing the appended elements. Each new element inherits the data of the current elements, if any.

                              The generic refers to the type of the child element to be appended.

                              Parameter type

                              A string representing the tag name. The specified name may have a namespace prefix, such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used (for example, svg implies svg:svg)

                            • Appends a new element of the type provided by the element creator function as the last child of each selected element, or before the next following sibling in the update selection if this is an enter selection. The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; however, note that selection.order may still be required if updating elements change order (i.e., if the order of new data is inconsistent with old data).

                              This method returns a new selection containing the appended elements. Each new element inherits the data of the current elements, if any.

                              The generic refers to the type of the child element to be appended.

                              Parameter type

                              A creator function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return an element to be appended. (The function typically creates a new element, but it may instead return an existing element.)

                            method attr

                            attr: {
                            (name: string): string;
                            (name: string, value: null): this;
                            (name: string, value: string | number | boolean): this;
                            (
                            name: string,
                            value: ValueFn<GElement, Datum, string | number | boolean>
                            ): this;
                            };
                            • Return the current value of the specified attribute for the first (non-null) element in the selection. This is generally useful only if you know that the selection contains exactly one element.

                              Parameter name

                              Name of the attribute

                            • Clear the attribute with the specified name for the selected elements and returns this selection.

                              Parameter name

                              Name of the attribute

                              Parameter value

                              null,to clear the attribute

                            • Sets the value of the attribute with the specified name for the selected elements and returns this selection. All elements are given the same attribute value.

                              Parameter name

                              Name of the attribute

                              Parameter value

                              Constant value for the attribute

                            • Sets the value of the attribute with the specified name for the selected elements and returns this selection. The value for the individual selected elements is determined by the value function.

                              Parameter name

                              Name of the attribute

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the attribute.

                            method call

                            call: (
                            func: (
                            selection: Selection<GElement, Datum, PElement, PDatum>,
                            ...args: any[]
                            ) => void,
                            ...args: any[]
                            ) => this;
                            • Invoke the specified function exactly once, passing in this selection along with any optional arguments. Returns this selection.

                              Parameter func

                              A function which is passed this selection as the first argument along with any optional arguments.

                              Parameter args

                              List of optional arguments to be passed to the callback function.

                            method classed

                            classed: {
                            (names: string): boolean;
                            (names: string, value: boolean): this;
                            (names: string, value: ValueFn<GElement, Datum, boolean>): this;
                            };
                            • Returns true if and only if the first (non-null) selected element has the specified classes. This is generally useful only if you know the selection contains exactly one element.

                              Parameter names

                              A string of space-separated class names.

                            • Assigns or unassigns the specified CSS class names on the selected elements by setting the class attribute or modifying the classList property and returns this selection. If the constant value is truthy, then all elements are assigned the specified classes; otherwise, the classes are unassigned.

                              Parameter names

                              A string of space-separated class names.

                              Parameter value

                              A boolean flag (true = assign / false = unassign)

                            • Assigns or unassigns the specified CSS class names on the selected elements by setting the class attribute or modifying the classList property and returns this selection. The assign/unassign status for the individual selected elements is determined by the boolean return value of the value function.

                              Parameter names

                              A string of space-separated class names.

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The function’s return value is then used to assign or unassign classes on each element.

                            method clone

                            clone: (deep?: boolean) => Selection<GElement, Datum, PElement, PDatum>;
                            • Inserts clones of the selected elements immediately following the selected elements and returns a selection of the newly added clones. If deep is true, the descendant nodes of the selected elements will be cloned as well. Otherwise, only the elements themselves will be cloned.

                              Parameter deep

                              Perform deep cloning if this flag is set to true.

                            method data

                            data: {
                            (): Datum[];
                            <NewDatum>(
                            data: NewDatum[] | Iterable<NewDatum>,
                            key?: ValueFn<GElement | PElement, Datum | NewDatum, KeyType>
                            ): Selection<GElement, NewDatum, PElement, PDatum>;
                            <NewDatum>(
                            data: ValueFn<PElement, PDatum, NewDatum[] | Iterable<NewDatum>>,
                            key?: ValueFn<GElement | PElement, Datum | NewDatum, KeyType>
                            ): Selection<GElement, NewDatum, PElement, PDatum>;
                            };
                            • Returns the array of data for the selected elements.

                            • Joins the specified array of data with the selected elements, returning a new selection that represents the update selection: the elements successfully bound to data. Also defines the enter and exit selections on the returned selection, which can be used to add or remove elements to correspond to the new data.

                              The data is specified for each group in the selection. If the selection has multiple groups (such as d3.selectAll followed by selection.selectAll), then data should typically be specified as a function.

                              If a key function is not specified, then the first datum in data is assigned to the first selected element, the second datum to the second selected element, and so on. A key function may be specified to control which datum is assigned to which element, replacing the default join-by-index, by computing a string identifier for each datum and element.

                              The update and enter selections are returned in data order, while the exit selection preserves the selection order prior to the join. If a key function is specified, the order of elements in the selection may not match their order in the document; use selection.order or selection.sort as needed.

                              This method cannot be used to clear bound data; use selection.datum instead.

                              For details see: https://github.com/d3/d3-selection#joining-data

                              The generic refers to the type of the new datum to be used for the selected elements.

                              Parameter data

                              The specified data is an array or iterable of arbitrary values (e.g., numbers or objects).

                              Parameter key

                              An optional key function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]); the returned string is the element’s key. The key function is then also evaluated for each new datum in data, being passed the current datum (d), the current index (i), and the group’s new data, with this as the group’s parent DOM element (nodes[i]); the returned string is the datum’s key. The datum for a given key is assigned to the element with the matching key. If multiple elements have the same key, the duplicate elements are put into the exit selection; if multiple data have the same key, the duplicate data are put into the enter selection.

                            • Joins the data returned by the specified value function with the selected elements, returning a new selection that it represents the update selection: the elements successfully bound to data. Also defines the enter and exit selections on the returned selection, which can be used to add or remove elements to correspond to the new data.

                              The data is specified for each group in the selection.

                              If a key function is not specified, then the first datum in data is assigned to the first selected element, the second datum to the second selected element, and so on. A key function may be specified to control which datum is assigned to which element, replacing the default join-by-index, by computing a string identifier for each datum and element.

                              The update and enter selections are returned in data order, while the exit selection preserves the selection order prior to the join. If a key function is specified, the order of elements in the selection may not match their order in the document; use selection.order or selection.sort as needed.

                              This method cannot be used to clear bound data; use selection.datum instead.

                              For details see: https://github.com/d3/d3-selection#joining-data

                              The generic refers to the type of the new datum to be used for the selected elements.

                              Parameter data

                              A value function which will be evaluated for each group in order, being passed the group’s parent datum (d, which may be undefined), the group index (i), and the selection’s parent nodes (nodes), with this as the group’s parent element. The function returns an array or iterable of values for each group.

                              Parameter key

                              An optional key function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]); the returned string is the element’s key. The key function is then also evaluated for each new datum in data, being passed the current datum (d), the current index (i), and the group’s new data, with this as the group’s parent DOM element (nodes[i]); the returned string is the datum’s key. The datum for a given key is assigned to the element with the matching key. If multiple elements have the same key, the duplicate elements are put into the exit selection; if multiple data have the same key, the duplicate data are put into the enter selection.

                            method datum

                            datum: {
                            (): Datum;
                            (value: null): Selection<GElement, undefined, PElement, PDatum>;
                            <NewDatum>(value: ValueFn<GElement, Datum, NewDatum>): Selection<
                            GElement,
                            NewDatum,
                            PElement,
                            PDatum
                            >;
                            <NewDatum>(value: NewDatum): Selection<GElement, NewDatum, PElement, PDatum>;
                            };
                            • Returns the bound datum for the first (non-null) element in the selection. This is generally useful only if you know the selection contains exactly one element.

                            • Delete the bound data for each element in the selection.

                            • Sets the element’s bound data using the specified value function on all selected elements. Unlike selection.data, this method does not compute a join and does not affect indexes or the enter and exit selections.

                              The generic refers to the type of the new datum to be used for the selected elements.

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The function is then used to set each element’s new data. A null value will delete the bound data.

                            • Sets the element’s bound data to the specified value on all selected elements. Unlike selection.data, this method does not compute a join and does not affect indexes or the enter and exit selections.

                              The generic refers to the type of the new datum to be used for the selected elements.

                              Parameter value

                              A value object to be used as the datum for each element.

                            method dispatch

                            dispatch: {
                            (type: string, parameters?: CustomEventParameters): this;
                            (
                            type: string,
                            parameters?: ValueFn<GElement, Datum, CustomEventParameters>
                            ): this;
                            };
                            • Dispatches a custom event of the specified type to each selected element, in order. An optional parameters map may be specified to set additional properties of the event.

                              Parameter type

                              Name of event to dispatch

                              Parameter parameters

                              An optional value map with custom event parameters

                            • Dispatches a custom event of the specified type to each selected element, in order. An optional value function returning a parameters map for each element in the selection may be specified to set additional properties of the event.

                              Parameter type

                              Name of event to dispatch

                              Parameter parameters

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return the parameters map for the current element.

                            method each

                            each: (func: ValueFn<GElement, Datum, void>) => this;
                            • Invoke the specified function for each selected element, passing in the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]). This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously.

                              Parameter func

                              A function which is invoked for each selected element, being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).

                            method empty

                            empty: () => boolean;
                            • Return true if this selection contains no (non-null) elements.

                            method enter

                            enter: () => Selection<EnterElement, Datum, PElement, PDatum>;
                            • Return the enter selection: placeholder nodes for each datum that had no corresponding DOM element in the selection. (The enter selection is empty for selections not returned by selection.data.)

                            method exit

                            exit: <OldDatum>() => Selection<GElement, OldDatum, PElement, PDatum>;
                            • Returns the exit selection: existing DOM elements in the selection for which no new datum was found. (The exit selection is empty for selections not returned by selection.data.)

                              IMPORTANT: The generic refers to the type of the old datum associated with the exit selection elements. Ensure you set the generic to the correct type, if you need to access the data on the exit selection in follow-up steps, e.g. to set styles as part of an exit transition before removing them.

                            method filter

                            filter: {
                            (selector: string): Selection<GElement, Datum, PElement, PDatum>;
                            <FilteredElement extends BaseType>(selector: string): Selection<
                            FilteredElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            (selector: ValueFn<GElement, Datum, boolean>): Selection<
                            GElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            <FilteredElement extends BaseType>(
                            selector: ValueFn<GElement, Datum, boolean>
                            ): Selection<FilteredElement, Datum, PElement, PDatum>;
                            };
                            • Filters the selection, returning a new selection that contains only the elements for which the specified filter is true.

                              The returned filtered selection preserves the parents of this selection, but like array.filter, it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.

                              Parameter selector

                              A CSS selector string to match when filtering.

                            • Filters the selection, returning a new selection that contains only the elements for which the specified filter is true.

                              The returned filtered selection preserves the parents of this selection, but like array.filter, it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.

                              The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types contained in a pre-filter selection are narrowed to a subset as part of the filtering.

                              Parameter selector

                              A CSS selector string to match when filtering.

                            • Filter the selection, returning a new selection that contains only the elements for which the specified filter is true.

                              The returned filtered selection preserves the parents of this selection, but like array.filter, it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.

                              Parameter selector

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return true for an element to be included, and false otherwise.

                            method html

                            html: {
                            (): string;
                            (value: null): this;
                            (value: string): this;
                            (value: ValueFn<GElement, Datum, string>): this;
                            };
                            • Returns a string representation of the inner HTML for the first (non-null) element in the selection. This is generally useful only if you know the selection contains exactly one element.

                            • Clear the html content of the selected elements and return the selection.

                            • Sets the inner HTML to the specified value on all selected elements, replacing any existing child elements. All elements are given the same inner HTML

                              Parameter value

                              String representation of inner HTML.

                            • Sets the inner HTML to the specified value on all selected elements, replacing any existing child elements. The inner HTML is determined for each individual element using a value function.

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The function’s return value is then used to set each element’s inner HTML. A null value will clear the content.

                            method insert

                            insert: {
                            <
                            K extends
                            | 'symbol'
                            | 'circle'
                            | 'clipPath'
                            | 'defs'
                            | 'desc'
                            | 'ellipse'
                            | 'feBlend'
                            | 'feColorMatrix'
                            | 'feComponentTransfer'
                            | 'feComposite'
                            | 'feConvolveMatrix'
                            | 'feDiffuseLighting'
                            | 'feDisplacementMap'
                            | 'feDistantLight'
                            | 'feFlood'
                            | 'feFuncA'
                            | 'feFuncB'
                            | 'feFuncG'
                            | 'feFuncR'
                            | 'feGaussianBlur'
                            | 'feImage'
                            | 'feMerge'
                            | 'feMergeNode'
                            | 'feMorphology'
                            | 'feOffset'
                            | 'fePointLight'
                            | 'feSpecularLighting'
                            | 'feSpotLight'
                            | 'feTile'
                            | 'feTurbulence'
                            | 'filter'
                            | 'foreignObject'
                            | 'g'
                            | 'image'
                            | 'line'
                            | 'linearGradient'
                            | 'marker'
                            | 'mask'
                            | 'metadata'
                            | 'path'
                            | 'pattern'
                            | 'polygon'
                            | 'polyline'
                            | 'radialGradient'
                            | 'rect'
                            | 'stop'
                            | 'svg'
                            | 'switch'
                            | 'text'
                            | 'textPath'
                            | 'tspan'
                            | 'use'
                            | 'view'
                            | keyof HTMLElementTagNameMap
                            >(
                            type: K,
                            before?: string | ValueFn<GElement, Datum, BaseType>
                            ): Selection<ElementTagNameMap[K], Datum, PElement, PDatum>;
                            <ChildElement extends BaseType>(
                            type: string | ValueFn<GElement, Datum, ChildElement>,
                            before?: string | ValueFn<GElement, Datum, BaseType>
                            ): Selection<ChildElement, Datum, PElement, PDatum>;
                            };
                            • Inserts a new element of the specified type (tag name) before the first element matching the specified before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child. If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.)

                              This method returns a new selection containing the appended elements. Each new element inherits the data of the current elements, if any.

                              The generic refers to the type of the child element to be appended.

                              Parameter type

                              A string representing the tag name for the element type to be inserted.

                              Parameter before

                              One of: * A CSS selector string for the element before which the insertion should occur. * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return the child element before which the element should be inserted.

                            • Inserts a new element of the specified type (tag name) before the first element matching the specified before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child. If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.)

                              This method returns a new selection containing the appended elements. Each new element inherits the data of the current elements, if any.

                              The generic refers to the type of the child element to be appended.

                              Parameter type

                              One of: * A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix, such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used (for example, svg implies svg:svg) * A creator function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)

                              Parameter before

                              One of: * A CSS selector string for the element before which the insertion should occur. * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return the child element before which the element should be inserted.

                            method join

                            join: {
                            <
                            K extends
                            | 'symbol'
                            | 'circle'
                            | 'clipPath'
                            | 'defs'
                            | 'desc'
                            | 'ellipse'
                            | 'feBlend'
                            | 'feColorMatrix'
                            | 'feComponentTransfer'
                            | 'feComposite'
                            | 'feConvolveMatrix'
                            | 'feDiffuseLighting'
                            | 'feDisplacementMap'
                            | 'feDistantLight'
                            | 'feFlood'
                            | 'feFuncA'
                            | 'feFuncB'
                            | 'feFuncG'
                            | 'feFuncR'
                            | 'feGaussianBlur'
                            | 'feImage'
                            | 'feMerge'
                            | 'feMergeNode'
                            | 'feMorphology'
                            | 'feOffset'
                            | 'fePointLight'
                            | 'feSpecularLighting'
                            | 'feSpotLight'
                            | 'feTile'
                            | 'feTurbulence'
                            | 'filter'
                            | 'foreignObject'
                            | 'g'
                            | 'image'
                            | 'line'
                            | 'linearGradient'
                            | 'marker'
                            | 'mask'
                            | 'metadata'
                            | 'path'
                            | 'pattern'
                            | 'polygon'
                            | 'polyline'
                            | 'radialGradient'
                            | 'rect'
                            | 'stop'
                            | 'svg'
                            | 'switch'
                            | 'text'
                            | 'textPath'
                            | 'tspan'
                            | 'use'
                            | 'view'
                            | keyof HTMLElementTagNameMap,
                            OldDatum = Datum
                            >(
                            enter: K,
                            update?: (
                            elem: Selection<GElement, Datum, PElement, PDatum>
                            ) => Selection<GElement, Datum, PElement, PDatum> | undefined,
                            exit?: (elem: Selection<GElement, OldDatum, PElement, PDatum>) => void
                            ): Selection<GElement | ElementTagNameMap[K], Datum, PElement, PDatum>;
                            <ChildElement extends BaseType, OldDatum = Datum>(
                            enter: string,
                            update?: (
                            elem: Selection<GElement, Datum, PElement, PDatum>
                            ) => Selection<GElement, Datum, PElement, PDatum>,
                            exit?: (elem: Selection<GElement, OldDatum, PElement, PDatum>) => void
                            ): Selection<GElement | ChildElement, Datum, PElement, PDatum>;
                            <ChildElement extends BaseType, OldDatum = Datum>(
                            enter: (
                            elem: Selection<EnterElement, Datum, PElement, PDatum>
                            ) => Selection<ChildElement, Datum, PElement, PDatum>,
                            update?: (
                            elem: Selection<GElement, Datum, PElement, PDatum>
                            ) => Selection<GElement, Datum, PElement, PDatum>,
                            exit?: (elem: Selection<GElement, OldDatum, PElement, PDatum>) => void
                            ): Selection<GElement | ChildElement, Datum, PElement, PDatum>;
                            };
                            • Appends, removes and reorders elements as necessary to match the data that was previously bound by selection.data, returning the merged enter and update selection. This method is a convenient alternative to the more explicit selection.enter, selection.exit, selection.append and selection.remove.

                              The "matching" logic is determined by the key function passed to selection.data.

                            method lower

                            lower: () => this;
                            • Re-insert each selected element, in order, as the first child of its parent.

                            method merge

                            merge: (
                            other: Selection<GElement, Datum, PElement, PDatum>
                            ) => Selection<GElement, Datum, PElement, PDatum>;
                            • Returns a new selection merging this selection with the specified other selection. The returned selection has the same number of groups and the same parents as this selection. Any missing (null) elements in this selection are filled with the corresponding element, if present (not null), from the specified selection. (If the other selection has additional groups or parents, they are ignored.)

                              This method is commonly used to merge the enter and update selections after a data-join. After modifying the entering and updating elements separately, you can merge the two selections and perform operations on both without duplicate code.

                              This method is not intended for concatenating arbitrary selections, however: if both this selection and the specified other selection have (non-null) elements at the same index, this selection’s element is returned in the merge and the other selection’s element is ignored.

                              Parameter other

                              Selection to be merged.

                            method node

                            node: () => GElement | null;
                            • Return the first (non-null) element in this selection. If the selection is empty, returns null.

                            method nodes

                            nodes: () => GElement[];
                            • Return an array of all (non-null) elements in this selection.

                            method on

                            on: {
                            (typenames: string): (this: GElement, event: any, d: Datum) => void;
                            (typenames: string, listener: null): this;
                            (
                            typenames: string,
                            listener: (this: GElement, event: any, d: Datum) => void,
                            options?: any
                            ): this;
                            };
                            • Return the currently-assigned listener for the specified event typename on the first (non-null) selected element, if any, If multiple typenames are specified, the first matching listener is returned.

                              Parameter typenames

                              The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used. The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces, such as "input change"" or "click.foo click.bar".

                            • Remove a listener for the specified event type names. To remove all listeners for a given name, pass null as the listener and ".foo" as the typename, where foo is the name; to remove all listeners with no name, specify "." as the typename.

                              Parameter typenames

                              The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used. The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces, such as "input change"" or "click.foo click.bar".

                              Parameter listener

                              null to indicate removal of listener

                            • Add an event listener for the specified event type names. If an event listener was previously registered for the same typename on a selected element, the old listener is removed before the new listener is added.

                              When a specified event is dispatched on a selected node, the specified listener will be evaluated for each selected element.

                              Parameter typenames

                              The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used. The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces, such as "input change"" or "click.foo click.bar".

                              Parameter listener

                              A listener function which will be evaluated for each selected element, being passed the current event (event) and the current datum (d), with this as the current DOM element (event.currentTarget). Listeners always see the latest datum for their element. Note: while you can use event.pageX and event.pageY directly, it is often convenient to transform the event position to the local coordinate system of that element that received the event using d3.pointer.

                              Parameter options

                              An optional options object may specify characteristics about the event listener, such as wehether it is captures or passive; see element.addEventListener.

                            method order

                            order: () => this;
                            • Re-insert elements into the document such that the document order of each group matches the selection order. This is equivalent to calling selection.sort if the data is already sorted, but much faster.

                            method property

                            property: {
                            (name: string): any;
                            <T>(name: Local<T>): T;
                            (name: string, value: ValueFn<GElement, Datum, any>): this;
                            (name: string, value: null): this;
                            (name: string, value: any): this;
                            <T>(name: Local<T>, value: ValueFn<GElement, Datum, T>): this;
                            <T>(name: Local<T>, value: T): this;
                            };
                            • Return the current value of the specified property for the first (non-null) element in the selection. This is generally useful only if you know that the selection contains exactly one element.

                              Parameter name

                              Name of the property

                            • Look up a local variable on the first node of this selection. Note that this is not equivalent to local.get(selection.node()) in that it will not look up locals set on the parent node(s).

                              Parameter name

                              The d3.local variable to look up.

                            • Sets the value of the property with the specified name for the selected elements and returns this selection. The value for the individual selected elements is determined by the value function.

                              Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value and a checkbox’s checked boolean. Use this method to get or set these properties.

                              Parameter name

                              Name of the property

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the property.

                            • Clears the property with the specified name for the selected elements and returns this selection.

                              Parameter name

                              Name of the property

                              Parameter value

                              null,to clear the property

                            • Sets the value of the property with the specified name for the selected elements and returns this selection. All elements are given the same property value.

                              Parameter name

                              Name of the property

                              Parameter value

                              Constant value for the property

                            • Store a value in a d3.local variable. This is equivalent to selection.each(function (d, i, g) { name.set(this, value.call(this, d, i, g)); }) but more concise.

                              Parameter name

                              A d3.local variable

                              Parameter value

                              A callback that returns the value to store

                            • Store a value in a d3.local variable for each node in the selection. This is equivalent to selection.each(function () { name.set(this, value); }) but more concise.

                              Parameter name

                              A d3.local variable

                              Parameter value

                              A callback that returns the value to store

                            method raise

                            raise: () => this;
                            • Re-insert each selected element, in order, as the last child of its parent.

                            method remove

                            remove: () => this;
                            • Removes the selected elements from the document. Returns this selection (the removed elements) which are now detached from the DOM.

                            method select

                            select: {
                            <DescElement extends BaseType>(selector: string): Selection<
                            DescElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            <DescElement extends BaseType>(selector: null): Selection<
                            null,
                            undefined,
                            PElement,
                            PDatum
                            >;
                            <DescElement extends BaseType>(
                            selector: ValueFn<GElement, Datum, DescElement>
                            ): Selection<DescElement, Datum, PElement, PDatum>;
                            };
                            • For each selected element, select the first descendant element that matches the specified selector string. If no element matches the specified selector for the current element, the element at the current index will be null in the returned selection. If multiple elements match the selector, only the first matching element in document order is selected. Selection.select does not affect grouping: it preserves the existing group structure and indexes, and propagates data (if any) to selected children.

                              If the current element has associated data, this data is propagated to the corresponding selected element.

                              The generic represents the type of the descendant element to be selected.

                              Parameter selector

                              CSS selector string

                            • Create an empty sub-selection. Selection.select does not affect grouping: it preserves the existing group structure and indexes.

                            • For each selected element, select the descendant element returned by the selector function. If no element is returned by the selector function for the current element, the element at the current index will be null in the returned selection. Selection.select does not affect grouping: it preserves the existing group structure and indexes, and propagates data (if any) to selected children.

                              If the current element has associated data, this data is propagated to the corresponding selected element.

                              The generic represents the type of the descendant element to be selected.

                              Parameter selector

                              A selector function, which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return an element, or null if there is no matching element.

                            method selectAll

                            selectAll: {
                            (): Selection<null, undefined, GElement, Datum>;
                            (selector: null): Selection<null, undefined, GElement, Datum>;
                            (selector: undefined): Selection<null, undefined, GElement, Datum>;
                            <DescElement extends BaseType, OldDatum>(selector: string): Selection<
                            DescElement,
                            OldDatum,
                            GElement,
                            Datum
                            >;
                            <DescElement extends BaseType, OldDatum>(
                            selector: ValueFn<
                            GElement,
                            Datum,
                            DescElement[] | ArrayLike<DescElement> | Iterable<DescElement>
                            >
                            ): Selection<DescElement, OldDatum, GElement, Datum>;
                            };
                            • Create an empty sub-selection. Selection.selectAll does affect grouping: The elements in the returned selection are grouped by their corresponding parent node in this selection, the group at the current index will be empty.

                            • For each selected element, selects the descendant elements that match the specified selector string. The elements in the returned selection are grouped by their corresponding parent node in this selection. If no element matches the specified selector for the current element, the group at the current index will be empty. Selection.selectAll does affect grouping: each selected descendant is grouped by the parent element in the originating selection.

                              The selected elements do not inherit data from this selection; use selection.data to propagate data to children.

                              The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.

                              Parameter selector

                              CSS selector string

                            • For each selected element, selects the descendant elements returned by the selector function. The elements in the returned selection are grouped by their corresponding parent node in this selection. If no element matches the specified selector for the current element, the group at the current index will be empty. Selection.selectAll does affect grouping: each selected descendant is grouped by the parent element in the originating selection.

                              The selected elements do not inherit data from this selection; use selection.data to propagate data to children.

                              The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.

                              Parameter selector

                              A selector function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return an array of elements (or an iterable, or a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.

                            method selectChild

                            selectChild: {
                            <DescElement extends BaseType>(): Selection<
                            DescElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            <DescElement extends BaseType>(selector: string): Selection<
                            DescElement,
                            Datum,
                            PElement,
                            PDatum
                            >;
                            <ResultElement extends BaseType, ChildElement extends BaseType>(
                            selector: (
                            child: ChildElement,
                            i: number,
                            children: ChildElement[]
                            ) => boolean
                            ): Selection<ResultElement, Datum, PElement, PDatum>;
                            };
                            • Returns a new selection with the (first) child of each element of the current selection matching the selector. Selects the first child (if any).

                              The generic represents the type of the descendant element to be selected.

                            • Returns a new selection with the (first) child of each element of the current selection matching the selector. Selects the first child that matches (if any).

                              The generic represents the type of the descendant element to be selected.

                              Parameter selector

                              CSS selector string

                            • Returns a new selection with the (first) child of each element of the current selection matching the selector.

                              The first generic represents the type of the descendant element to be selected. The second generic represents the type of any of the child elements.

                              Parameter selector

                              A selector function, which is evaluated for each of the children nodes, in order, being passed the child (child), the child’s index (i), and the list of children (children); the method selects the first child for which the selector return truthy, if any.

                            method selectChildren

                            selectChildren: {
                            <DescElement extends BaseType, OldDatum>(): Selection<
                            DescElement,
                            OldDatum,
                            GElement,
                            Datum
                            >;
                            <DescElement extends BaseType, OldDatum>(selector: string): Selection<
                            DescElement,
                            OldDatum,
                            GElement,
                            Datum
                            >;
                            <ResultElement extends BaseType, ResultDatum, ChildElement extends BaseType>(
                            selector: (
                            child: ChildElement,
                            i: number,
                            children: ChildElement[]
                            ) => boolean
                            ): Selection<ResultElement, ResultDatum, GElement, Datum>;
                            };
                            • Returns a new selection with the children of each element of the current selection matching the selector. Selects all the children

                              The first generic represents the type of the descendant element to be selected. The second generic refers to the type of the datum of the element to be selected.

                            • Returns a new selection with the children of each element of the current selection matching the selector. Selects the children that match (if any)

                              The first generic represents the type of the descendant element to be selected. The second generic refers to the type of the datum of the element to be selected.

                              Parameter selector

                              CSS selector string

                            • Returns a new selection with the children of each element of the current selection matching the selector.

                              The first generic represents the type of the descendant element to be selected. The second generic refers to the type of the datum of the element to be selected. The third generic represents the type of any of the child elements.

                              Parameter selector

                              A selector function, which is evaluated for each of the children nodes, in order, being passed the child (child), the child’s index (i), and the list of children (children); the method selects the first child for which the selector return truthy, if any.

                            method selection

                            selection: () => this;
                            • Returns the selection (for symmetry with transition.selection).

                            method size

                            size: () => number;
                            • Returns the total number of elements in this selection.

                            method sort

                            sort: (comparator?: (a: Datum, b: Datum) => number) => this;
                            • Return a new selection that contains a copy of each group in this selection sorted according to the compare function. After sorting, re-inserts elements to match the resulting order (per selection.order).

                              Note that sorting is not guaranteed to be stable; however, it is guaranteed to have the same behavior as your browser’s built-in sort method on arrays.

                              Parameter comparator

                              An optional comparator function, which defaults to "ascending". The function is passed two elements’ data a and b to compare. It should return either a negative, positive, or zero value. If negative, then a should be before b; if positive, then a should be after b; otherwise, a and b are considered equal and the order is arbitrary.

                            method style

                            style: {
                            (name: string): string;
                            (name: string, value: null): this;
                            (
                            name: string,
                            value: string | number | boolean,
                            priority?: 'important'
                            ): this;
                            (
                            name: string,
                            value: ValueFn<GElement, Datum, string | number | boolean>,
                            priority?: 'important'
                            ): this;
                            };
                            • Returns the current value of the specified style property for the first (non-null) element in the selection. The current value is defined as the element’s inline value, if present, and otherwise its computed value. Accessing the current style value is generally useful only if you know the selection contains exactly one element.

                              Parameter name

                              Name of the style

                            • Clear the style with the specified name for the selected elements and returns this selection.

                              Parameter name

                              Name of the style

                              Parameter value

                              null,to clear the style

                            • Sets the value of the style with the specified name for the selected elements and returns this selection. All elements are given the same style value.

                              Parameter name

                              Name of the style

                              Parameter value

                              Constant value for the style

                              Parameter priority

                              An optional priority flag, either null or the string important (without the exclamation point)

                            • Sets the value of the style with the specified name for the selected elements and returns this selection. The value for the individual selected elements is determined by the value function.

                              Parameter name

                              Name of the style

                              Parameter value

                              A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the style.

                              Parameter priority

                              An optional priority flag, either null or the string important (without the exclamation point)

                            method text

                            text: {
                            (): string;
                            (value: null): this;
                            (value: string | number | boolean): this;
                            (value: ValueFn<GElement, Datum, string | number | boolean>): this;
                            };
                            • Returns the text content for the first (non-null) element in the selection. This is generally useful only if you know the selection contains exactly one element.

                            • Clear the text content of the selected elements and return the selection.

                            • Sets the text content to the specified value on all selected elements, replacing any existing child elements. All elements are given the same text content.

                              Parameter value

                              Text content value for the elements.

                            • Sets the text content to the specified value on all selected elements, replacing any existing child elements. All elements are given the same text content.

                              Parameter value

                              A value unction which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The function’s return value is then used to set each element’s text content. A null value will clear the content.

                            interface TransitionLike

                            interface TransitionLike<GElement extends BaseType, Datum> {}
                            • TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file. For example, wherever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its selection() method to retrieve the underlying Selection object before proceeding. d3-brush uses a subset of Transition methods internally. The use of this interface instead of the full imported Transition interface is [referred] to achieve two things: (1) the d3-transition module may not be required by a projects use case, (2) it avoids possible complications from 'module augmentation' from d3-transition to Selection.

                            method on

                            on: {
                            (type: string, listener: null): TransitionLike<GElement, Datum>;
                            (type: string, listener: ValueFn<GElement, Datum, void>): TransitionLike<
                            GElement,
                            Datum
                            >;
                            };

                              method selection

                              selection: () => Selection<GElement, Datum, any, any>;

                                method tween

                                tween: {
                                (name: string, tweenFn: null): TransitionLike<GElement, Datum>;
                                (
                                name: string,
                                tweenFn: ValueFn<GElement, Datum, (t: number) => void>
                                ): TransitionLike<GElement, Datum>;
                                };

                                  Type Aliases

                                  type BaseType

                                  type BaseType = Element | EnterElement | Document | Window | null;
                                  • BaseType serves as an alias for the 'minimal' data type which can be selected without 'd3-selection' trying to use properties internally which would otherwise not be supported.

                                  type ContainerElement

                                  type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement;
                                  • Container element type usable for mouse/touch functions

                                  type KeyType

                                  type KeyType = string | number;
                                  • KeyType serves as alias for valid types that d3 supports as key for data binding

                                  type SelectionFn

                                  type SelectionFn = () => Selection<HTMLElement, any, null, undefined>;
                                  • Selects the root element, document.documentElement. This function can also be used to test for selections (instanceof d3.selection) or to extend the selection prototype.

                                  type ValueFn

                                  type ValueFn<T extends BaseType, Datum, Result> = (
                                  this: T,
                                  datum: Datum,
                                  index: number,
                                  groups: T[] | ArrayLike<T>
                                  ) => Result;
                                  • Callback type for selections and transitions

                                  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-selection.

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