Interface Transition<GElement, Datum, PElement, PDatum>

A D3 Transition.

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

interface Transition {
    attr(name, value): Transition<GElement, Datum, PElement, PDatum>;
    attr(name, value): Transition<GElement, Datum, PElement, PDatum>;
    attrTween(name): ValueFn<GElement, Datum, ((this, t) => string)>;
    attrTween(name, factory): Transition<GElement, Datum, PElement, PDatum>;
    attrTween(name, factory): Transition<GElement, Datum, PElement, PDatum>;
    call(func, ...args): Transition<GElement, Datum, PElement, PDatum>;
    delay(): number;
    delay(milliseconds): Transition<GElement, Datum, PElement, PDatum>;
    delay(milliseconds): Transition<GElement, Datum, PElement, PDatum>;
    duration(): number;
    duration(milliseconds): Transition<GElement, Datum, PElement, PDatum>;
    duration(milliseconds): Transition<GElement, Datum, PElement, PDatum>;
    each(func): Transition<GElement, Datum, PElement, PDatum>;
    ease(): ((normalizedTime) => number);
    ease(easingFn): Transition<GElement, Datum, PElement, PDatum>;
    easeVarying(factory): Transition<GElement, Datum, PElement, PDatum>;
    empty(): boolean;
    end(): Promise<void>;
    filter(filter): Transition<GElement, Datum, PElement, PDatum>;
    filter<FilteredElement>(filter): Transition<FilteredElement, Datum, PElement, PDatum>;
    filter(filter): Transition<GElement, Datum, PElement, PDatum>;
    filter<FilteredElement>(filter): Transition<FilteredElement, Datum, PElement, PDatum>;
    merge(other): Transition<GElement, Datum, PElement, PDatum>;
    node(): GElement;
    nodes(): GElement[];
    on(typenames): ValueFn<GElement, Datum, void>;
    on(typenames, listener): Transition<GElement, Datum, PElement, PDatum>;
    on(typenames, listener): Transition<GElement, Datum, PElement, PDatum>;
    remove(): Transition<GElement, Datum, PElement, PDatum>;
    select<DescElement>(selector): Transition<DescElement, Datum, PElement, PDatum>;
    select<DescElement>(selector): Transition<DescElement, Datum, PElement, PDatum>;
    selectAll<DescElement, OldDatum>(selector): Transition<DescElement, OldDatum, GElement, Datum>;
    selectAll<DescElement, OldDatum>(selector): Transition<DescElement, OldDatum, GElement, Datum>;
    selectChild<DescElement, OldDatum>(selector?): Transition<DescElement, OldDatum, GElement, Datum>;
    selectChildren<DescElement, OldDatum>(selector?): Transition<DescElement, OldDatum, GElement, Datum>;
    selection(): Selection<GElement, Datum, PElement, PDatum>;
    size(): number;
    style(name, value): Transition<GElement, Datum, PElement, PDatum>;
    style(name, value, priority?): Transition<GElement, Datum, PElement, PDatum>;
    style(name, value, priority?): Transition<GElement, Datum, PElement, PDatum>;
    styleTween(name): ValueFn<GElement, Datum, ((this, t) => string)>;
    styleTween(name, factory): Transition<GElement, Datum, PElement, PDatum>;
    styleTween(name, factory, priority?): Transition<GElement, Datum, PElement, PDatum>;
    text(value): Transition<GElement, Datum, PElement, PDatum>;
    text(value): Transition<GElement, Datum, PElement, PDatum>;
    textTween(): ValueFn<GElement, Datum, ((this, t) => string)>;
    textTween(factory): Transition<GElement, Datum, PElement, PDatum>;
    textTween(factory): Transition<GElement, Datum, PElement, PDatum>;
    transition(): Transition<GElement, Datum, PElement, PDatum>;
    tween(name): ValueFn<GElement, Datum, ((this, t) => void)>;
    tween(name, tweenFn): Transition<GElement, Datum, PElement, PDatum>;
    tween(name, tweenFn): Transition<GElement, Datum, PElement, PDatum>;
}

Type Parameters

Methods

  • For each selected element, assigns the attribute tween for the attribute with the specified name to the specified target value. The starting value of the tween is the attribute’s value when the transition starts. If the target value is null, the attribute is removed when the transition starts.

    Parameters

    • name: string
    • value: string | number | boolean

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, assigns the attribute tween for the attribute with the specified name to the specified target value. The starting value of the tween is the attribute’s value when the transition starts. The target value is return value of the value function evaluated for the selected element.

    An interpolator is chosen based on the type of the target value, using the following algorithm: 1.) If value is a number, use interpolateNumber. 2.) If value is a color or a string coercible to a color, use interpolateRgb. 3.) Use interpolateString.

    To apply a different interpolator, use transition.attrTween.

    Parameters

    • name: string

      Name of the attribute.

    • value: ValueFn<GElement, Datum, string | number | boolean>

      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 at the start of the transition.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Return the current interpolator factory for attribute with the specified name, or undefined if no such tween exists.

    Parameters

    • name: string

      Name of attribute.

    Returns ValueFn<GElement, Datum, ((this, t) => string)>

  • Remove the previously-assigned attribute tween of the specified name, if any.

    Parameters

    • name: string

      Name of attribute.

    • factory: null

      Use null to remove previously-assigned attribute tween.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Assign the attribute tween for the attribute with the specified name to the specified interpolator factory. An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the attribute value. The interpolator must return a string.

    Parameters

    • name: string

      Name of attribute.

    • factory: ValueFn<GElement, Datum, ((this, t) => string)>

      An interpolator factory 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 interpolator factory returns a string interpolator, which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Invoke the specified function exactly once, passing in this transition along with any optional arguments. Returns this transition.

    Parameters

    • func: ((transition, ...args) => any)

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

        • (transition, ...args): any
        • Parameters

          • transition: Transition<GElement, Datum, PElement, PDatum>
          • Rest ...args: any[]

          Returns any

    • Rest ...args: any[]

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

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns the current value of the delay for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.

    Returns number

  • For each selected element, sets the transition delay to the specified value in milliseconds. If a delay is not specified, it defaults to zero.

    Parameters

    • milliseconds: number

      Number of milliseconds for the delay.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, sets the transition delay to the value in milliseconds returned by the value function.

    Parameters

    • milliseconds: ValueFn<GElement, Datum, number>

      A value function which is evaluated for each selected element, 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 return value is a number specifying the delay in milliseconds.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns the current value of the duration for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.

    Returns number

  • For each selected element, sets the transition duration to the specified value in milliseconds. If a duration is not specified, it defaults to 250ms.

    Parameters

    • milliseconds: number

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, sets the transition duration to the value in milliseconds returned by the value function.

    Parameters

    • milliseconds: ValueFn<GElement, Datum, number>

      A value function which is evaluated for each selected element, 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 return value is a number specifying the duration in milliseconds.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Invoke the specified function for each selected element, passing the current datum (d), the current index (i), and the current group (nodes), with this as 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.

    Parameters

    • func: ValueFn<GElement, Datum, void>

      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 as the current DOM element (nodes[i]).

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns the current easing function for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.

    Returns ((normalizedTime) => number)

      • (normalizedTime): number
      • Returns the current easing function for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.

        Parameters

        • normalizedTime: number

        Returns number

  • Specifies the transition easing function for all selected elements. The value must be specified as a function. The easing function is invoked for each frame of the animation, being passed the normalized time t in the range [0, 1]; it must then return the eased time tʹ which is typically also in the range [0, 1]. A good easing function should return 0 if t = 0 and 1 if t = 1. If an easing function is not specified, it defaults to d3.easeCubic.

    Parameters

    • easingFn: ((normalizedTime) => number)

      An easing function which is passed the normalized time t in the range [0, 1]; it must then return the eased time tʹ which is typically also in the range [0, 1]. A good easing function should return 0 if t = 0 and 1 if t = 1.

        • (normalizedTime): number
        • Parameters

          • normalizedTime: number

          Returns number

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Specifies a factory for the transition easing function.

    Parameters

    • factory: ValueFn<GElement, Datum, ((normalizedTime) => number)>

      The factory must be a function. It is invoked for each node of the selection, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. It must return an easing function.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Return true if this transition contains no (non-null) elements.

    Returns boolean

  • Returns a promise that resolves when every selected element finishes transitioning. If any element’s transition is cancelled or interrupted, the promise rejects.

    Returns Promise<void>

  • For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.

    The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    Parameters

    • filter: string

      A CSS selector string.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.

    The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    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.

    Type Parameters

    Parameters

    • filter: string

      A CSS selector string.

    Returns Transition<FilteredElement, Datum, PElement, PDatum>

  • For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.

    The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    Parameters

    • filter: ValueFn<GElement, Datum, boolean>

      A filter 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 filter function returns a boolean indicating, whether the selected element matches.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.

    The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    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.

    Type Parameters

    Parameters

    • filter: ValueFn<GElement, Datum, boolean>

      A filter 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 filter function returns a boolean indicating, whether the selected element matches.

    Returns Transition<FilteredElement, Datum, PElement, PDatum>

  • Returns a new transition merging this transition with the specified other transition, which must have the same id as this transition. The returned transition has the same number of groups, the same parents, the same name and the same id as this transition. Any missing (null) elements in this transition are filled with the corresponding element, if present (not null), from the other transition.

    Parameters

    • other: Transition<GElement, Datum, PElement, PDatum>

      The transition to be merged.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Return the first (non-null) element in this transition. If the transition is empty, returns null.

    Returns GElement

  • Return an array of all (non-null) elements in this transition.

    Returns GElement[]

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

    Parameters

    • typenames: string

      The typenames is one of the following string event types: start (when the transition starts), end (when the transition ends), interrupt (when the transition is interrupted), cancel(when the transition is cancelled). Note that these are not native DOM events. 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 "start.foo"" and "start.bar". To specify multiple typenames, separate typenames with spaces, such as "interrupt end"" or "start.foo start.bar".

    Returns ValueFn<GElement, Datum, void>

  • Remove all listeners for a given name.

    Parameters

    • typenames: string

      Name of the event type for which the listener should be removed. To remove all listeners for a given name use ".foo" as the typename, where foo is the name; to remove all listeners with no name, specify "." as the typename.

    • listener: null

      Use null to remove listeners.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Add a listener to each selected element for the specified event typenames.

    When a specified transition event is dispatched on a selected node, the specified listener will be invoked for each transitioning element. Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.

    Parameters

    • typenames: string

      The typenames is one of the following string event types: start (when the transition starts), end (when the transition ends), interrupt (when the transition is interrupted), cancel(when the transition is cancelled). Note that these are not native DOM events. 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 "start.foo"" and "start.bar". To specify multiple typenames, separate typenames with spaces, such as "interrupt end"" or "start.foo start.bar".

    • listener: ValueFn<GElement, Datum, void>

      A listener function which will be evaluated for each selected element, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, removes the element when the transition ends, as long as the element has no other active or pending transitions. If the element has other active or pending transitions, does nothing.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, select the first descendant element that matches the specified selector string, if any, and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

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

    Type Parameters

    Parameters

    • selector: string

      CSS selector string

    Returns Transition<DescElement, Datum, PElement, PDatum>

  • For each selected element, select the descendant element returned by the selector function, if any, and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

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

    Type Parameters

    Parameters

    • selector: ValueFn<GElement, Datum, DescElement>

      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.

    Returns Transition<DescElement, Datum, PElement, PDatum>

  • For each selected element, select all descendant elements that match the specified selector string, if any, and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    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.

    Type Parameters

    Parameters

    • selector: string

      CSS selector string

    Returns Transition<DescElement, OldDatum, GElement, Datum>

  • For each selected element, select all descendant elements returned by the selector function, if any, and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

    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.

    Type Parameters

    Parameters

    • selector: ValueFn<GElement, Datum, DescElement[] | ArrayLike<DescElement>>

      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 a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.

    Returns Transition<DescElement, OldDatum, GElement, Datum>

  • For each selected element, selects the first child element that matches the specified selector string, if any, and returns a transition on the resulting selection. The selector may be specified either as a selector string or a function. If a function, it 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. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element. This method is equivalent to deriving the selection for this transition via transition.selection, creating a subselection via selection.selectChild, and then creating a new transition via selection.transition.

    Type Parameters

    Parameters

    • Optional selector: string | ValueFn<GElement, Datum, DescElement>

    Returns Transition<DescElement, OldDatum, GElement, Datum>

  • For each selected element, selects all children that match the specified selector string, if any, and returns a transition on the resulting selection. The selector may be specified either as a selector string or a function. If a function, it 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. The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element. This method is equivalent to deriving the selection for this transition via transition.selection, creating a subselection via selection.selectChildren, and then creating a new transition via selection.transition.

    Type Parameters

    Parameters

    • Optional selector: string | ValueFn<GElement, Datum, DescElement>

    Returns Transition<DescElement, OldDatum, GElement, Datum>

  • Return the selection corresponding to this transition.

    Returns Selection<GElement, Datum, PElement, PDatum>

  • Returns the total number of elements in this transition.

    Returns number

  • For each selected element, the style with the specified name will be cleared at the start of the transition.

    Parameters

    • name: string

      Name of the style.

    • value: null

      Use null to clear the style.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, assigns the style tween for the style with the specified name to the specified target value with the specified priority. The starting value of the tween is the style’s inline value if present, and otherwise its computed value. The target value is the specified constant value for all elements.

    An interpolator is chosen based on the type of the target value, using the following algorithm: 1.) If value is a number, use interpolateNumber. 2.) If value is a color or a string coercible to a color, use interpolateRgb. 3.) Use interpolateString.

    To apply a different interpolator, use transition.attrTween.

    Parameters

    • name: string

      Name of the style.

    • value: string | number | boolean

      Target value for the style.

    • Optional priority: "important"

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

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, assigns the style tween for the style with the specified name to the specified target value with the specified priority. The starting value of the tween is the style's inline value if present, and otherwise its computed value. The target value is return value of the value function evaluated for the selected element.

    An interpolator is chosen based on the type of the target value, using the following algorithm: 1.) If value is a number, use interpolateNumber. 2.) If value is a color or a string coercible to a color, use interpolateRgb. 3.) Use interpolateString.

    To apply a different interpolator, use transition.attrTween.

    Parameters

    • name: string

      Name of the style.

    • value: ValueFn<GElement, Datum, string | number | boolean>

      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 at the start of the transition.

    • Optional priority: "important"

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

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Return the current interpolator factory for style with the specified name, or undefined if no such tween exists.

    Parameters

    • name: string

      Name of style.

    Returns ValueFn<GElement, Datum, ((this, t) => string)>

  • Remove the previously-assigned style tween of the specified name, if any.

    Parameters

    • name: string

      Name of style.

    • factory: null

      Use null to remove previously-assigned style tween.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Assign the style tween for the style with the specified name to the specified interpolator factory. An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the style value. The interpolator must return a string.

    Parameters

    • name: string

      Name of style.

    • factory: ValueFn<GElement, Datum, ((this, t) => string)>

      An interpolator factory 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 interpolator factory returns a string interpolator, which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.

    • Optional priority: "important"

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

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, sets the text content to the specified target value when the transition starts. A null value will clear the content.

    Parameters

    • value: string | number | boolean

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, sets the text content returned by the value function for each selected element when the transition starts.

    To interpolate text rather than to set it on start, use transition.textTween (for example) or append a replacement element and cross-fade opacity (for example). Text is not interpolated by default because it is usually undesirable.

    Parameters

    • value: ValueFn<GElement, Datum, string | number | boolean>

      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 text content at the start of the transition.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns the current interpolator factory for text, or undefined if no such tween exists.

    Returns ValueFn<GElement, Datum, ((this, t) => string)>

  • Removes the previously-assigned text tween, if any

    Parameters

    • factory: null

      Use null to remove previously-assigned text tween.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Assigns the text tween to the specified interpolator factory. An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element, in order, being passed the current datum d and index i, with the this context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the text. The interpolator must return a string.

    Parameters

    • factory: ValueFn<GElement, Datum, ((this, t) => string)>

      An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element, in order, being passed the current datum d and index i, with the this context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the text. The interpolator must return a string.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns a new transition on the same selected elements as this transition, scheduled to start when this transition ends. The new transition inherits a reference time equal to this transition’s time plus its delay and duration. The new transition also inherits this transition’s name, duration, and easing. This method can be used to schedule a sequence of chained transitions.

    A delay configured for the new transition will be relative to the previous transition.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • Returns the tween with the specified name, or undefined, if no tween was previously assigned to that name.

    Parameters

    • name: string

      Name of tween.

    Returns ValueFn<GElement, Datum, ((this, t) => void)>

  • Removes the tween with the specified name, if a tween was previously assigned to that name.

    Parameters

    • name: string

      Name of tween.

    • tweenFn: null

      Use null to remove a previously-assigned tween.

    Returns Transition<GElement, Datum, PElement, PDatum>

  • For each selected element, assigns the tween with the specified name with the specified value function. The value must be specified as a function that returns a function. When the transition starts, the value function is evaluated for each selected element. The returned function is then invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1].

    Parameters

    • name: string

      Name of tween.

    • tweenFn: ValueFn<GElement, Datum, ((this, t) => void)>

      A tween 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 tween function returns a function which takes as its argument eased time t, typically in the range [0, 1] and performs the tweening activities for each transition frame.

    Returns Transition<GElement, Datum, PElement, PDatum>