| 12345678910111213141516171819202122232425262728293031323334 |
- import { basePreInference, createBandOffset, visualMark } from './utils';
- /**
- * @todo Unify with text, image and point.
- */
- export const Shape = (options) => {
- const { cartesian } = options;
- if (cartesian)
- return visualMark;
- return (index, scale, value, coordinate) => {
- const { x: X, y: Y } = value;
- const offset = createBandOffset(scale, value, options);
- const P = Array.from(index, (i) => {
- const p = [+X[i], +Y[i]];
- return [coordinate.map(offset(p, i))];
- });
- return [index, P];
- };
- };
- Shape.props = {
- defaultShape: 'shape',
- defaultLabelShape: 'label',
- composite: false,
- channels: [
- { name: 'x', required: true },
- { name: 'y', required: true },
- ],
- preInference: [
- ...basePreInference(),
- { type: 'maybeTuple' },
- { type: 'maybeVisualPosition' },
- { type: 'maybeFunctionAttribute' },
- ],
- };
- //# sourceMappingURL=shape.js.map
|