| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.Cell = void 0;
- const utils_1 = require("./utils");
- /**
- * Convert value for each channel to Cell shapes.
- * Calc the bbox of each Cell based on x, y and r.
- * This is for allowing their radius can be affected by coordinate(e.g. fisheye).
- */
- const Cell = () => {
- return (index, scale, value, coordinate) => {
- const { x: X, y: Y } = value;
- const x = scale.x;
- const y = scale.y;
- const P = Array.from(index, (i) => {
- const width = x.getBandWidth(x.invert(+X[i]));
- const height = y.getBandWidth(y.invert(+Y[i]));
- const x1 = +X[i];
- const y1 = +Y[i];
- const p1 = [x1, y1];
- const p2 = [x1 + width, y1];
- const p3 = [x1 + width, y1 + height];
- const p4 = [x1, y1 + height];
- return [p1, p2, p3, p4].map((d) => coordinate.map(d));
- });
- return [index, P];
- };
- };
- exports.Cell = Cell;
- const shapes = ['cell', 'hollow'];
- exports.Cell.props = {
- defaultShape: 'cell',
- defaultLabelShape: 'label',
- composite: false,
- channels: [
- ...(0, utils_1.baseGeometryChannels)({ shapes }),
- { name: 'x', required: true, scale: 'band' },
- { name: 'y', required: true, scale: 'band' },
- ],
- preInference: [
- ...(0, utils_1.basePreInference)(),
- { type: 'maybeZeroX' },
- { type: 'maybeZeroY' },
- { type: 'maybeZeroPadding' },
- ],
- postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
- };
- //# sourceMappingURL=cell.js.map
|