source: node_modules/victory-vendor/lib-vendor/d3-shape/src/line.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 2.0 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _default;
7var _index = require("../../../lib-vendor/d3-path/src/index.js");
8var _array = _interopRequireDefault(require("./array.js"));
9var _constant = _interopRequireDefault(require("./constant.js"));
10var _linear = _interopRequireDefault(require("./curve/linear.js"));
11var _point = require("./point.js");
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13function _default(x, y) {
14 var defined = (0, _constant.default)(true),
15 context = null,
16 curve = _linear.default,
17 output = null;
18 x = typeof x === "function" ? x : x === undefined ? _point.x : (0, _constant.default)(x);
19 y = typeof y === "function" ? y : y === undefined ? _point.y : (0, _constant.default)(y);
20 function line(data) {
21 var i,
22 n = (data = (0, _array.default)(data)).length,
23 d,
24 defined0 = false,
25 buffer;
26 if (context == null) output = curve(buffer = (0, _index.path)());
27 for (i = 0; i <= n; ++i) {
28 if (!(i < n && defined(d = data[i], i, data)) === defined0) {
29 if (defined0 = !defined0) output.lineStart();else output.lineEnd();
30 }
31 if (defined0) output.point(+x(d, i, data), +y(d, i, data));
32 }
33 if (buffer) return output = null, buffer + "" || null;
34 }
35 line.x = function (_) {
36 return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constant.default)(+_), line) : x;
37 };
38 line.y = function (_) {
39 return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constant.default)(+_), line) : y;
40 };
41 line.defined = function (_) {
42 return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constant.default)(!!_), line) : defined;
43 };
44 line.curve = function (_) {
45 return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
46 };
47 line.context = function (_) {
48 return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
49 };
50 return line;
51}
Note: See TracBrowser for help on using the repository browser.