rect.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.Rect = void 0;
  4. const utils_1 = require("./utils");
  5. const Rect = () => {
  6. return (index, scale, value, coordinate) => {
  7. const { x: X, x1: X1, y: Y, y1: Y1 } = value;
  8. const P = Array.from(index, (i) => {
  9. const p1 = [+X[i], +Y[i]];
  10. const p2 = [+X1[i], +Y[i]];
  11. const p3 = [+X1[i], +Y1[i]];
  12. const p4 = [+X[i], +Y1[i]];
  13. return [p1, p2, p3, p4].map((d) => coordinate.map(d));
  14. });
  15. return [index, P];
  16. };
  17. };
  18. exports.Rect = Rect;
  19. const shapes = ['rect', 'hollow'];
  20. exports.Rect.props = {
  21. defaultShape: 'rect',
  22. defaultLabelShape: 'label',
  23. composite: false,
  24. channels: [
  25. ...(0, utils_1.baseGeometryChannels)({ shapes }),
  26. { name: 'x', required: true },
  27. { name: 'y', required: true },
  28. ],
  29. preInference: [...(0, utils_1.basePreInference)(), { type: 'maybeZeroY1' }],
  30. postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
  31. interaction: {
  32. shareTooltip: true,
  33. },
  34. };
  35. //# sourceMappingURL=rect.js.map