smooth.js 1.3 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. var __rest = (this && this.__rest) || function (s, e) {
  3. var t = {};
  4. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  5. t[p] = s[p];
  6. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  7. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  8. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  9. t[p[i]] = s[p[i]];
  10. }
  11. return t;
  12. };
  13. Object.defineProperty(exports, "__esModule", { value: true });
  14. exports.Smooth = void 0;
  15. const d3_shape_1 = require("d3-shape");
  16. const coordinate_1 = require("../../utils/coordinate");
  17. const curve_1 = require("./curve");
  18. const Smooth = (options) => {
  19. const { alpha = 0.5 } = options, rest = __rest(options, ["alpha"]);
  20. return (P, value, coordinate, theme) => {
  21. const curve = (0, coordinate_1.isPolar)(coordinate) ? d3_shape_1.curveCatmullRomClosed : d3_shape_1.curveCatmullRom;
  22. return (0, curve_1.Curve)(Object.assign({ curve: curve.alpha(alpha) }, rest))(P, value, coordinate, theme);
  23. };
  24. };
  25. exports.Smooth = Smooth;
  26. exports.Smooth.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'smooth' });
  27. //# sourceMappingURL=smooth.js.map