react-plot
Advanced tools
Comparing version
@@ -21,4 +21,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
x2: value, | ||
y1: y1, | ||
y2: y2, | ||
y1, | ||
y2, | ||
}, | ||
@@ -25,0 +25,0 @@ text: { |
@@ -21,4 +21,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
y2: value, | ||
x1: x1, | ||
x2: x2, | ||
x1, | ||
x2, | ||
}, | ||
@@ -25,0 +25,0 @@ text: { y1: value, x1: isRight ? textPosition : -textPosition }, |
@@ -101,3 +101,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
}; | ||
return (_jsx(plotContext.Provider, { value: plotContextValue, children: _jsx(plotDispatchContext.Provider, { value: dispatch, children: _jsx(LegendProvider, { children: _jsxs("div", { style: { position: 'relative', width: width, height: height }, children: [_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, style: { | ||
return (_jsx(plotContext.Provider, { value: plotContextValue, children: _jsx(plotDispatchContext.Provider, { value: dispatch, children: _jsx(LegendProvider, { children: _jsxs("div", { style: { position: 'relative', width, height }, children: [_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, style: { | ||
...finalSvgStyle, | ||
@@ -104,0 +104,0 @@ position: 'absolute', |
@@ -43,13 +43,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
useEffect(() => { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine, | ||
shape, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}, [colorLine, legendDispatch, otherProps.label, shape, id]); | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine, | ||
shape, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
}, [colorLine, legendDispatch, otherProps.label, shape, id, hidden]); | ||
if (hidden) | ||
@@ -56,0 +58,0 @@ return null; |
@@ -1,2 +0,2 @@ | ||
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useMemo } from 'react'; | ||
@@ -32,4 +32,4 @@ import { usePlotContext } from '../../contexts/plotContext'; | ||
}, [x === null || x === void 0 ? void 0 : x.domain[0], x === null || x === void 0 ? void 0 : x.domain[1]]); | ||
return (_jsx(_Fragment, { children: _jsx(LineSeries, { data: data, id: id, ...otherProps }) })); | ||
return _jsx(LineSeries, { data: data, id: id, ...otherProps }); | ||
} | ||
//# sourceMappingURL=FunctionSeries.js.map |
@@ -26,16 +26,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
var _a, _b, _c; | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine: ((_a = lineStyle === null || lineStyle === void 0 ? void 0 : lineStyle.stroke) === null || _a === void 0 ? void 0 : _a.toString()) || colorScaler(id), | ||
shape: { | ||
color: ((_c = (_b = otherProps.markerStyle) === null || _b === void 0 ? void 0 : _b.fill) === null || _c === void 0 ? void 0 : _c.toString()) || colorScaler(id), | ||
figure: otherProps.markerShape || 'circle', | ||
hidden: !displayMarkers, | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine: ((_a = lineStyle === null || lineStyle === void 0 ? void 0 : lineStyle.stroke) === null || _a === void 0 ? void 0 : _a.toString()) || colorScaler(id), | ||
shape: { | ||
color: ((_c = (_b = otherProps.markerStyle) === null || _b === void 0 ? void 0 : _b.fill) === null || _c === void 0 ? void 0 : _c.toString()) || colorScaler(id), | ||
figure: otherProps.markerShape || 'circle', | ||
hidden: !displayMarkers, | ||
}, | ||
}, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
}, [ | ||
@@ -50,3 +52,2 @@ hidden, | ||
otherProps.markerShape, | ||
otherProps.markerStyle, | ||
(_a = otherProps.markerStyle) === null || _a === void 0 ? void 0 : _a.fill, | ||
@@ -53,0 +54,0 @@ ]); |
@@ -39,18 +39,20 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
useEffect(() => { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label, | ||
colorLine: lineStyle.stroke, | ||
range: { | ||
rangeColor: lineStyle.fill, | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label, | ||
colorLine: lineStyle.stroke, | ||
range: { | ||
rangeColor: lineStyle.fill || 'none', | ||
}, | ||
}, | ||
}, | ||
}); | ||
return () => legendDispatch({ | ||
type: 'REMOVE_LEGEND_LABEL', | ||
payload: { id }, | ||
}); | ||
}, [label, legendDispatch, lineStyle.fill, lineStyle.stroke, id]); | ||
}); | ||
return () => legendDispatch({ | ||
type: 'REMOVE_LEGEND_LABEL', | ||
payload: { id }, | ||
}); | ||
} | ||
}, [label, legendDispatch, lineStyle.fill, lineStyle.stroke, id, hidden]); | ||
if (hidden) | ||
@@ -57,0 +59,0 @@ return null; |
@@ -42,4 +42,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}, [ | ||
@@ -46,0 +46,0 @@ colorScaler, |
@@ -29,5 +29,5 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; | ||
return { annotations: null }; | ||
const annotations = (_jsxs(_Fragment, { children: [_jsx(Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, x1: "0%", x2: "100%", y1: hover[verticalAxisId], y2: hover[verticalAxisId], ...lineProps }), _jsx(Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, y1: "0%", y2: "100%", x1: hover[horizontalAxisId], x2: hover[horizontalAxisId], ...lineProps }), _jsxs(Text, { xAxis: horizontalAxisId, yAxis: verticalAxisId, "text-anchor": "end", "alignment-baseline": "after-edge", x: hover[horizontalAxisId], y: hover[verticalAxisId], ...textProps, children: [(_a = hover[horizontalAxisId]) === null || _a === void 0 ? void 0 : _a.toFixed(2), " ,", (_b = hover[verticalAxisId]) === null || _b === void 0 ? void 0 : _b.toFixed(2)] })] })); | ||
const annotations = (_jsxs(_Fragment, { children: [_jsx(Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, x1: "0%", x2: "100%", y1: hover[verticalAxisId], y2: hover[verticalAxisId], ...lineProps }), _jsx(Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, y1: "0%", y2: "100%", x1: hover[horizontalAxisId], x2: hover[horizontalAxisId], ...lineProps }), _jsxs(Text, { xAxis: horizontalAxisId, yAxis: verticalAxisId, textAnchor: "end", alignmentBaseline: "after-edge", x: hover[horizontalAxisId], y: hover[verticalAxisId], ...textProps, children: [(_a = hover[horizontalAxisId]) === null || _a === void 0 ? void 0 : _a.toFixed(2), " ,", (_b = hover[verticalAxisId]) === null || _b === void 0 ? void 0 : _b.toFixed(2)] })] })); | ||
return { annotations }; | ||
} | ||
//# sourceMappingURL=useCrossHair.js.map |
@@ -26,4 +26,4 @@ "use strict"; | ||
x2: value, | ||
y1: y1, | ||
y2: y2, | ||
y1, | ||
y2, | ||
}, | ||
@@ -30,0 +30,0 @@ text: { |
@@ -26,4 +26,4 @@ "use strict"; | ||
y2: value, | ||
x1: x1, | ||
x2: x2, | ||
x1, | ||
x2, | ||
}, | ||
@@ -30,0 +30,0 @@ text: { y1: value, x1: isRight ? textPosition : -textPosition }, |
@@ -107,3 +107,3 @@ "use strict"; | ||
}; | ||
return ((0, jsx_runtime_1.jsx)(plotContext_1.plotContext.Provider, { value: plotContextValue, children: (0, jsx_runtime_1.jsx)(plotContext_1.plotDispatchContext.Provider, { value: dispatch, children: (0, jsx_runtime_1.jsx)(legendContext_1.LegendProvider, { children: (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: width, height: height }, children: [(0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, style: { | ||
return ((0, jsx_runtime_1.jsx)(plotContext_1.plotContext.Provider, { value: plotContextValue, children: (0, jsx_runtime_1.jsx)(plotContext_1.plotDispatchContext.Provider, { value: dispatch, children: (0, jsx_runtime_1.jsx)(legendContext_1.LegendProvider, { children: (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width, height }, children: [(0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, style: { | ||
...finalSvgStyle, | ||
@@ -110,0 +110,0 @@ position: 'absolute', |
@@ -46,13 +46,15 @@ "use strict"; | ||
(0, react_1.useEffect)(() => { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine, | ||
shape, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}, [colorLine, legendDispatch, otherProps.label, shape, id]); | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine, | ||
shape, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
}, [colorLine, legendDispatch, otherProps.label, shape, id, hidden]); | ||
if (hidden) | ||
@@ -59,0 +61,0 @@ return null; |
@@ -35,4 +35,4 @@ "use strict"; | ||
}, [x === null || x === void 0 ? void 0 : x.domain[0], x === null || x === void 0 ? void 0 : x.domain[1]]); | ||
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(LineSeries_1.LineSeries, { data: data, id: id, ...otherProps }) })); | ||
return (0, jsx_runtime_1.jsx)(LineSeries_1.LineSeries, { data: data, id: id, ...otherProps }); | ||
} | ||
exports.FunctionSeries = FunctionSeries; |
@@ -29,16 +29,18 @@ "use strict"; | ||
var _a, _b, _c; | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine: ((_a = lineStyle === null || lineStyle === void 0 ? void 0 : lineStyle.stroke) === null || _a === void 0 ? void 0 : _a.toString()) || colorScaler(id), | ||
shape: { | ||
color: ((_c = (_b = otherProps.markerStyle) === null || _b === void 0 ? void 0 : _b.fill) === null || _c === void 0 ? void 0 : _c.toString()) || colorScaler(id), | ||
figure: otherProps.markerShape || 'circle', | ||
hidden: !displayMarkers, | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label: otherProps.label, | ||
colorLine: ((_a = lineStyle === null || lineStyle === void 0 ? void 0 : lineStyle.stroke) === null || _a === void 0 ? void 0 : _a.toString()) || colorScaler(id), | ||
shape: { | ||
color: ((_c = (_b = otherProps.markerStyle) === null || _b === void 0 ? void 0 : _b.fill) === null || _c === void 0 ? void 0 : _c.toString()) || colorScaler(id), | ||
figure: otherProps.markerShape || 'circle', | ||
hidden: !displayMarkers, | ||
}, | ||
}, | ||
}, | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
}, [ | ||
@@ -53,3 +55,2 @@ hidden, | ||
otherProps.markerShape, | ||
otherProps.markerStyle, | ||
(_a = otherProps.markerStyle) === null || _a === void 0 ? void 0 : _a.fill, | ||
@@ -56,0 +57,0 @@ ]); |
@@ -42,18 +42,20 @@ "use strict"; | ||
(0, react_1.useEffect)(() => { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label, | ||
colorLine: lineStyle.stroke, | ||
range: { | ||
rangeColor: lineStyle.fill, | ||
if (!hidden) { | ||
legendDispatch({ | ||
type: 'ADD_LEGEND_LABEL', | ||
payload: { | ||
id, | ||
label, | ||
colorLine: lineStyle.stroke, | ||
range: { | ||
rangeColor: lineStyle.fill || 'none', | ||
}, | ||
}, | ||
}, | ||
}); | ||
return () => legendDispatch({ | ||
type: 'REMOVE_LEGEND_LABEL', | ||
payload: { id }, | ||
}); | ||
}, [label, legendDispatch, lineStyle.fill, lineStyle.stroke, id]); | ||
}); | ||
return () => legendDispatch({ | ||
type: 'REMOVE_LEGEND_LABEL', | ||
payload: { id }, | ||
}); | ||
} | ||
}, [label, legendDispatch, lineStyle.fill, lineStyle.stroke, id, hidden]); | ||
if (hidden) | ||
@@ -60,0 +62,0 @@ return null; |
@@ -48,4 +48,4 @@ "use strict"; | ||
}); | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
} | ||
return () => legendDispatch({ type: 'REMOVE_LEGEND_LABEL', payload: { id } }); | ||
}, [ | ||
@@ -52,0 +52,0 @@ colorScaler, |
@@ -32,5 +32,5 @@ "use strict"; | ||
return { annotations: null }; | ||
const annotations = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Line_1.Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, x1: "0%", x2: "100%", y1: hover[verticalAxisId], y2: hover[verticalAxisId], ...lineProps }), (0, jsx_runtime_1.jsx)(Line_1.Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, y1: "0%", y2: "100%", x1: hover[horizontalAxisId], x2: hover[horizontalAxisId], ...lineProps }), (0, jsx_runtime_1.jsxs)(Text_1.Text, { xAxis: horizontalAxisId, yAxis: verticalAxisId, "text-anchor": "end", "alignment-baseline": "after-edge", x: hover[horizontalAxisId], y: hover[verticalAxisId], ...textProps, children: [(_a = hover[horizontalAxisId]) === null || _a === void 0 ? void 0 : _a.toFixed(2), " ,", (_b = hover[verticalAxisId]) === null || _b === void 0 ? void 0 : _b.toFixed(2)] })] })); | ||
const annotations = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Line_1.Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, x1: "0%", x2: "100%", y1: hover[verticalAxisId], y2: hover[verticalAxisId], ...lineProps }), (0, jsx_runtime_1.jsx)(Line_1.Line, { xAxis: horizontalAxisId, yAxis: verticalAxisId, y1: "0%", y2: "100%", x1: hover[horizontalAxisId], x2: hover[horizontalAxisId], ...lineProps }), (0, jsx_runtime_1.jsxs)(Text_1.Text, { xAxis: horizontalAxisId, yAxis: verticalAxisId, textAnchor: "end", alignmentBaseline: "after-edge", x: hover[horizontalAxisId], y: hover[verticalAxisId], ...textProps, children: [(_a = hover[horizontalAxisId]) === null || _a === void 0 ? void 0 : _a.toFixed(2), " ,", (_b = hover[verticalAxisId]) === null || _b === void 0 ? void 0 : _b.toFixed(2)] })] })); | ||
return { annotations }; | ||
} | ||
exports.useCrossHair = useCrossHair; |
{ | ||
"name": "react-plot", | ||
"version": "0.20.1", | ||
"version": "0.20.2", | ||
"description": "Library of React components to render SVG 2D plots.", | ||
@@ -56,8 +56,8 @@ "main": "lib/index.js", | ||
"@simbathesailor/use-what-changed": "^2.0.0", | ||
"@storybook/addon-essentials": "^6.5.4", | ||
"@storybook/addon-links": "^6.5.4", | ||
"@storybook/addon-storysource": "^6.5.4", | ||
"@storybook/builder-webpack5": "^6.5.4", | ||
"@storybook/manager-webpack5": "^6.5.4", | ||
"@storybook/react": "^6.5.4", | ||
"@storybook/addon-essentials": "^6.5.10", | ||
"@storybook/addon-links": "^6.5.10", | ||
"@storybook/addon-storysource": "^6.5.10", | ||
"@storybook/builder-webpack5": "^6.5.10", | ||
"@storybook/manager-webpack5": "^6.5.10", | ||
"@storybook/react": "^6.5.10", | ||
"@types/d3-array": "^3.0.3", | ||
@@ -69,6 +69,6 @@ "@types/d3-scale": "^4.0.2", | ||
"@types/react": "^17.0.45", | ||
"@zakodium/eslint-config": "^5.1.1", | ||
"eslint": "^8.16.0", | ||
"isotopic-distribution": "^1.4.11", | ||
"iv-analysis": "^0.1.3", | ||
"@zakodium/eslint-config": "^6.0.0", | ||
"eslint": "^8.23.0", | ||
"isotopic-distribution": "^1.4.12", | ||
"iv-analysis": "^0.3.0", | ||
"ml-dataset-iris": "^1.2.1", | ||
@@ -78,20 +78,23 @@ "ml-directional-distribution": "^0.1.0", | ||
"ml-regression-simple-linear": "^2.0.3", | ||
"ml-spectra-processing": "^11.6.0", | ||
"ms-spectrum": "^1.6.4", | ||
"ml-spectra-processing": "^11.12.0", | ||
"ms-spectrum": "^1.6.10", | ||
"point-in-polygon": "^1.1.0", | ||
"prettier": "^2.6.2", | ||
"prettier": "^2.7.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"typescript": "^4.6.4", | ||
"webpack": "^5.72.1" | ||
"typescript": "^4.8.3", | ||
"webpack": "^5.74.0" | ||
}, | ||
"dependencies": { | ||
"d3-array": "^3.1.6", | ||
"d3-array": "^3.2.0", | ||
"d3-scale": "^4.0.2", | ||
"d3-scale-chromatic": "^3.0.0", | ||
"d3-shape": "^3.1.0", | ||
"immer": "^9.0.14", | ||
"immer": "^9.0.15", | ||
"ml-distance-euclidean": "^2.0.0", | ||
"react-d3-utils": "^0.5.1" | ||
}, | ||
"volta": { | ||
"node": "16.17.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
486577
0.08%7867
0.13%Updated
Updated