Function piecewise

  • Returns a piecewise zoom interpolator, composing zoom interpolators for each adjacent pair of zoom view. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through three different zoom views: d3.piecewise(d3.interpolateZoom, [[0, 0, 1], [0, 0, 10], [0, 0, 15]]).

    interpolate defaults to d3.interpolate.

    Parameters

    Returns ZoomInterpolator

  • Returns a piecewise zoom interpolator, composing zoom interpolators for each adjacent pair of zoom view. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through three different zoom views: d3.piecewise(d3.interpolateZoom, [[0, 0, 1], [0, 0, 10], [0, 0, 15]]).

    Parameters

    Returns ZoomInterpolator

  • Returns a piecewise array interpolator, composing array interpolators for each adjacent pair of arrays. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through three different arrays: d3.piecewise(d3.interpolateArray, [[0, 0, 1], [0, 0, 10], [0, 0, 15]]).

    interpolate defaults to d3.interpolate.

    Type Parameters

    • A extends any[]

    Parameters

    • values: A[]

    Returns ArrayInterpolator<A>

  • Returns a piecewise array interpolator, composing array interpolators for each adjacent pair of arrays. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through three different arrays: d3.piecewise(d3.interpolateArray, [[0, 0, 1], [0, 0, 10], [0, 0, 15]]).

    Type Parameters

    • A extends any[]

    Parameters

    Returns ArrayInterpolator<A>

  • Returns a piecewise interpolator, composing interpolators for each adjacent pair of values. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through red, green and blue: d3.piecewise(d3.interpolateRgb.gamma(2.2), ["red", "green", "blue"]).

    interpolate defaults to d3.interpolate.

    Parameters

    • values: unknown[]

    Returns ((t) => any)

      • (t): any
      • Parameters

        • t: number

        Returns any

  • Returns a piecewise interpolator, composing interpolators for each adjacent pair of values. The returned interpolator maps t in [0, 1 / (n - 1)] to interpolate(values[0], values[1]), t in [1 / (n - 1), 2 / (n - 1)] to interpolate(values[1], values[2]), and so on, where n = values.length. In effect, this is a lightweight linear scale. For example, to blend through red, green and blue: d3.piecewise(d3.interpolateRgb.gamma(2.2), ["red", "green", "blue"]).

    Type Parameters

    • TData

    Parameters

    • interpolate: ((a, b) => unknown)
        • (a, b): unknown
        • Parameters

          • a: TData
          • b: TData

          Returns unknown

    • values: TData[]

    Returns ((t) => any)

      • (t): any
      • Parameters

        • t: number

        Returns any