# All files / src/components ZeroLine.jsx

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32

    2x

    2x
    2x
    2x
    2x
    2x

    2x
     import { Line } from '@vx/shape';
    import { Point } from '@vx/point';
    import React from 'react';
    import PropTypes from 'prop-types';

    const propTypes = {
      xScale: PropTypes.func.isRequired,
      yScale: PropTypes.func.isRequired,
    };

    export default function ZeroLine({
      xScale,
      yScale,
    }) {
      const [y0, y1] = yScale.range();
      const x = xScale(0);
      const fromPoint = new Point({ x, y: y0 });
      const toPoint = new Point({ x, y: y1 });
      return (
        <Line
          from={fromPoint}
          to={toPoint}
          strokeWidth={2}
          strokeDasharray="8 4"
          stroke="#484848"
          vectorEffect="non-scaling-stroke"
        />
      );
    }

    ZeroLine.propTypes = propTypes;