react-plot
Version:
Library of React components to render SVG 2D plots.
9 lines • 532 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { usePosition } from '../../hooks.js';
export function Line(props) {
const { x1: oldX1, x2: oldX2, y1: oldY1, y2: oldY2, color = 'black', xAxis = 'x', yAxis = 'y', ...lineProps } = props;
const { x: x1, y: y1 } = usePosition({ x: oldX1, y: oldY1, xAxis, yAxis });
const { x: x2, y: y2 } = usePosition({ x: oldX2, y: oldY2, xAxis, yAxis });
return _jsx("line", { x1: x1, x2: x2, y1: y1, y2: y2, stroke: color, ...lineProps });
}
//# sourceMappingURL=Line.js.map