Skip to content

d3.extentDiverging? #132

@mbostock

Description

@mbostock

It’d be nice to have a variant of d3.extent that returns a three-element array with zero in the middle for use with d3.scaleDiverging.

function extentDiverging() {
  const [x0, x1] = extent.apply(this, arguments);
  return [Math.min(0, x0), 0, Math.max(0, x1)];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions