lineX.js 799 B

12345678910111213141516171819202122232425
  1. import { basePostInference, baseAnnotationChannels, basePreInference, } from './utils';
  2. export const LineX = () => {
  3. return (index, scale, value, coordinate) => {
  4. const { x: X } = value;
  5. const P = Array.from(index, (i) => {
  6. const p1 = [X[i], 1];
  7. const p2 = [X[i], 0];
  8. return [p1, p2].map((d) => coordinate.map(d));
  9. });
  10. return [index, P];
  11. };
  12. };
  13. const shapes = ['line'];
  14. LineX.props = {
  15. defaultShape: 'line',
  16. defaultLabelShape: 'label',
  17. composite: false,
  18. channels: [
  19. ...baseAnnotationChannels({ shapes }),
  20. { name: 'x', required: true },
  21. ],
  22. preInference: [...basePreInference(), { type: 'maybeTupleX' }],
  23. postInference: [...basePostInference()],
  24. };
  25. //# sourceMappingURL=lineX.js.map