MCPcopy
hub / github.com/jipegit/OSXAuditor / area

Function area

d3-3.2.8/d3.js:7229–7250  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

7227 function d3_svg_area(projection) {
7228 var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
7229 function area(data) {
7230 var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
7231 return x;
7232 } : d3_functor(x1), fy1 = y0 === y1 ? function() {
7233 return y;
7234 } : d3_functor(y1), x, y;
7235 function segment() {
7236 segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
7237 }
7238 while (++i < n) {
7239 if (defined.call(this, d = data[i], i)) {
7240 points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
7241 points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
7242 } else if (points0.length) {
7243 segment();
7244 points0 = [];
7245 points1 = [];
7246 }
7247 }
7248 if (points0.length) segment();
7249 return segments.length ? segments.join("") : null;
7250 }
7251 area.x = function(_) {
7252 if (!arguments.length) return x1;
7253 x0 = x1 = _;

Callers 6

path-test.jsFile · 0.85
area-test.jsFile · 0.85
testInterpolationFunction · 0.85
area-test.jsFile · 0.85
testInterpolationFunction · 0.85

Calls 2

d3_functorFunction · 0.85
segmentFunction · 0.85

Tested by

no test coverage detected