Sha256: 74137eeeda4997087ca4154ebfdf588071c3db171598526c262cb2313c0da38f

Contents?: true

Size: 1.8 KB

Versions: 25

Compression:

Stored size: 1.8 KB

Contents

function d3_svg_area(projection) {
  var x0 = d3_svg_lineX,
      x1 = d3_svg_lineX,
      y0 = 0,
      y1 = d3_svg_lineY,
      interpolate,
      i0,
      i1,
      tension = .7;

  function area(d) {
    if (d.length < 1) return null;
    var points0 = d3_svg_linePoints(this, d, x0, y0),
        points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1);
    return "M" + i0(projection(points1), tension)
         + "L" + i1(projection(points0.reverse()), tension)
         + "Z";
  }

  area.x = function(x) {
    if (!arguments.length) return x1;
    x0 = x1 = x;
    return area;
  };

  area.x0 = function(x) {
    if (!arguments.length) return x0;
    x0 = x;
    return area;
  };

  area.x1 = function(x) {
    if (!arguments.length) return x1;
    x1 = x;
    return area;
  };

  area.y = function(y) {
    if (!arguments.length) return y1;
    y0 = y1 = y;
    return area;
  };

  area.y0 = function(y) {
    if (!arguments.length) return y0;
    y0 = y;
    return area;
  };

  area.y1 = function(y) {
    if (!arguments.length) return y1;
    y1 = y;
    return area;
  };

  area.interpolate = function(x) {
    if (!arguments.length) return interpolate;
    i0 = d3_svg_lineInterpolators[interpolate = x];
    i1 = i0.reverse || i0;
    return area;
  };

  area.tension = function(x) {
    if (!arguments.length) return tension;
    tension = x;
    return area;
  };

  return area.interpolate("linear");
}

d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;

d3.svg.area = function() {
  return d3_svg_area(Object);
};

function d3_svg_areaX(points) {
  return function(d, i) {
    return points[i][0];
  };
}

function d3_svg_areaY(points) {
  return function(d, i) {
    return points[i][1];
  };
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/src/svg/area.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/src/svg/area.js