MCPcopy Create free account
hub / github.com/idank/explainshell / area

Function area

explainshell/web/static/js/d3.v3.js:6885–6906  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

6883 function d3_svg_area(projection) {
6884 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;
6885 function area(data) {
6886 var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
6887 return x;
6888 } : d3_functor(x1), fy1 = y0 === y1 ? function() {
6889 return y;
6890 } : d3_functor(y1), x, y;
6891 function segment() {
6892 segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
6893 }
6894 while (++i < n) {
6895 if (defined.call(this, d = data[i], i)) {
6896 points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
6897 points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
6898 } else if (points0.length) {
6899 segment();
6900 points0 = [];
6901 points1 = [];
6902 }
6903 }
6904 if (points0.length) segment();
6905 return segments.length ? segments.join("") : null;
6906 }
6907 area.x = function(_) {
6908 if (!arguments.length) return x1;
6909 x0 = x1 = _;

Callers

nothing calls this directly

Calls 3

d3_functorFunction · 0.85
segmentFunction · 0.85
callMethod · 0.45

Tested by

no test coverage detected