UNPKG

react-plot

Version:

Library of React components to render SVG 2D plots.

8 lines 1.63 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { bboxContext } from '../../contexts/bboxContext.js'; import TransparentRect from '../TransparentRect.js'; export default function MainLayer(props) { const { width, height, svgStyle, svgId, svgClassName, plotViewportStyle, seriesViewportStyle, topOffset, leftOffset, plotWidth, plotHeight, plotId, series, topAxisRef, topAxis, rightAxisRef, rightAxis, bottomAxisRef, bottomAxis, leftAxisRef, leftAxis, headingRef, heading, } = props; return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, style: svgStyle, id: svgId, className: svgClassName, children: [_jsx(TransparentRect, { width: width, height: height, style: plotViewportStyle }), _jsxs("g", { transform: `translate(${leftOffset}, ${topOffset})`, children: [_jsx(TransparentRect, { width: plotWidth, height: plotHeight, style: seriesViewportStyle }), _jsx("clipPath", { id: `seriesViewportClip-${plotId}`, children: _jsx("rect", { width: plotWidth, height: plotHeight }) }), _jsx("g", { style: { clipPath: `url(#seriesViewportClip-${plotId})` }, children: series }), _jsx(bboxContext.Provider, { value: topAxisRef, children: _jsx("g", { children: topAxis }) }), _jsx(bboxContext.Provider, { value: rightAxisRef, children: _jsx("g", { children: rightAxis }) }), _jsx(bboxContext.Provider, { value: bottomAxisRef, children: _jsx("g", { children: bottomAxis }) }), _jsx(bboxContext.Provider, { value: leftAxisRef, children: _jsx("g", { children: leftAxis }) })] }), _jsx("g", { ref: headingRef, children: heading })] })); } //# sourceMappingURL=MainLayer.js.map