lineY.js 799 B

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