Sha256: 27f70214a1a99bd8debf8e86fe3f4288542c2b34e922b51a54fcd2a7106272d1

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

import "../arrays/bisect";
import "scale";

d3.scale.threshold = function() {
  return d3_scale_threshold([0.5], [0, 1]);
};

function d3_scale_threshold(domain, range) {

  function scale(x) {
    if (x <= x) return range[d3.bisect(domain, x)];
  }

  scale.domain = function(_) {
    if (!arguments.length) return domain;
    domain = _;
    return scale;
  };

  scale.range = function(_) {
    if (!arguments.length) return range;
    range = _;
    return scale;
  };

  scale.invertExtent = function(y) {
    y = range.indexOf(y);
    return [domain[y - 1], domain[y]];
  };

  scale.copy = function() {
    return d3_scale_threshold(domain, range);
  };

  return scale;
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mdarray-sol-0.1.0-java node_modules/dc/node_modules/d3/src/scale/threshold.js