Skip to content

Commit 5d46e79

Browse files
committed
chore: update dependencies
1 parent 4ddaef5 commit 5d46e79

File tree

8 files changed

+76
-81
lines changed

8 files changed

+76
-81
lines changed

package.json

+20-17
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,45 @@
5353
},
5454
"devDependencies": {
5555
"@simbathesailor/use-what-changed": "^2.0.0",
56-
"@storybook/addon-essentials": "^6.5.4",
57-
"@storybook/addon-links": "^6.5.4",
58-
"@storybook/addon-storysource": "^6.5.4",
59-
"@storybook/builder-webpack5": "^6.5.4",
60-
"@storybook/manager-webpack5": "^6.5.4",
61-
"@storybook/react": "^6.5.4",
56+
"@storybook/addon-essentials": "^6.5.10",
57+
"@storybook/addon-links": "^6.5.10",
58+
"@storybook/addon-storysource": "^6.5.10",
59+
"@storybook/builder-webpack5": "^6.5.10",
60+
"@storybook/manager-webpack5": "^6.5.10",
61+
"@storybook/react": "^6.5.10",
6262
"@types/d3-array": "^3.0.3",
6363
"@types/d3-scale": "^4.0.2",
6464
"@types/d3-scale-chromatic": "^3.0.0",
6565
"@types/d3-shape": "^3.1.0",
6666
"@types/point-in-polygon": "^1.1.1",
6767
"@types/react": "^17.0.45",
68-
"@zakodium/eslint-config": "^5.1.1",
69-
"eslint": "^8.16.0",
70-
"isotopic-distribution": "^1.4.11",
71-
"iv-analysis": "^0.1.3",
68+
"@zakodium/eslint-config": "^6.0.0",
69+
"eslint": "^8.23.0",
70+
"isotopic-distribution": "^1.4.12",
71+
"iv-analysis": "^0.3.0",
7272
"ml-dataset-iris": "^1.2.1",
7373
"ml-directional-distribution": "^0.1.0",
7474
"ml-pca": "^4.0.2",
7575
"ml-regression-simple-linear": "^2.0.3",
76-
"ml-spectra-processing": "^11.6.0",
77-
"ms-spectrum": "^1.6.4",
76+
"ml-spectra-processing": "^11.12.0",
77+
"ms-spectrum": "^1.6.10",
7878
"point-in-polygon": "^1.1.0",
79-
"prettier": "^2.6.2",
79+
"prettier": "^2.7.1",
8080
"react": "^17.0.2",
8181
"react-dom": "^17.0.2",
82-
"typescript": "^4.6.4",
83-
"webpack": "^5.72.1"
82+
"typescript": "^4.8.3",
83+
"webpack": "^5.74.0"
8484
},
8585
"dependencies": {
86-
"d3-array": "^3.1.6",
86+
"d3-array": "^3.2.0",
8787
"d3-scale": "^4.0.2",
8888
"d3-scale-chromatic": "^3.0.0",
8989
"d3-shape": "^3.1.0",
90-
"immer": "^9.0.14",
90+
"immer": "^9.0.15",
9191
"ml-distance-euclidean": "^2.0.0",
9292
"react-d3-utils": "^0.5.1"
93+
},
94+
"volta": {
95+
"node": "16.17.0"
9396
}
9497
}

src/components/Axis/HorizontalAxis.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export default function HorizontalAxis(props: AxisRendererProps) {
4848
line: {
4949
x1: value,
5050
x2: value,
51-
y1: y1,
52-
y2: y2,
51+
y1,
52+
y2,
5353
},
5454
text: {
5555
x1: value,

src/components/Axis/VerticalAxis.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export default function VerticalAxis(props: AxisRendererProps) {
4848
line: {
4949
y1: value,
5050
y2: value,
51-
x1: x1,
52-
x2: x2,
51+
x1,
52+
x2,
5353
},
5454
text: { y1: value, x1: isRight ? textPosition : -textPosition },
5555
};

src/components/Plot.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export function Plot(props: PlotProps) {
212212
<plotContext.Provider value={plotContextValue}>
213213
<plotDispatchContext.Provider value={dispatch}>
214214
<LegendProvider>
215-
<div style={{ position: 'relative', width: width, height: height }}>
215+
<div style={{ position: 'relative', width, height }}>
216216
<svg
217217
xmlns="http://www.w3.org/2000/svg"
218218
width={width}

stories/examples/lassoselection.stories.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ export function LassoSelection({ disabled }: UseDrawPathOptions) {
5050
const path = useDrawPath({
5151
close: true,
5252
style: { fillOpacity: '0.2', stroke: 'black', strokeWidth: '2px' },
53-
onDraw(Newpoints) {
54-
if (Newpoints && Newpoints !== []) {
55-
setPoints(Newpoints);
56-
}
57-
},
53+
onDraw: setPoints,
5854
disabled,
5955
});
6056
const {

stories/examples/nasdaq.stories.tsx

+30-37
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export default {
1414
},
1515
} as Meta;
1616

17-
/** Util functions *****************/
18-
1917
const generateNewXY = (serie: SeriesPoint, step: number): [number, number] => {
2018
const x = serie.x + step;
2119
const rand = Math.floor(Math.random() * 10);
@@ -35,8 +33,6 @@ const getLastData = (
3533
return newVals;
3634
};
3735

38-
/** Main Component *****************/
39-
4036
type Props = Record<string, number>;
4137
export function NasdaqExample(props: Props) {
4238
const {
@@ -45,38 +41,35 @@ export function NasdaqExample(props: Props) {
4541
displayInterval, // interval to display (s)
4642
} = props;
4743

48-
function PlotRefresher() {
49-
const [data, setData] = useState(srcData);
44+
const [data, setData] = useState(srcData);
5045

51-
useEffect(() => {
52-
const timer = setTimeout(() => {
53-
const [x, y] = generateNewXY(data[data.length - 1], step); // generate a new coordinates
54-
const newData = getLastData([...data, { x, y }], displayInterval); // get last 500s data
55-
setData(newData);
56-
}, refreshFrequency * 1000);
57-
return () => clearTimeout(timer);
58-
}, [data]);
59-
//const timeFormat = new Intl.DateTimeFormat('en-GB', { timeStyle: 'short' });
60-
return (
61-
<Plot {...DEFAULT_PLOT_CONFIG}>
62-
<Heading title="Nasdaq values Simulation" />
63-
<LineSeries
64-
data={data.map(({ x, y }) => ({ x: x * 1000, y }))}
65-
xAxis="x"
66-
yAxis="y"
67-
lineStyle={{ stroke: 'green', strokeWidth: 1.5 }}
68-
/>
69-
<Axis id="x" position="bottom" label="Time (hh:mm)" scale="time" />
70-
<Axis
71-
id="y"
72-
position="left"
73-
label="Nasdaq value [USD]"
74-
displayPrimaryGridLines
75-
paddingStart="10%"
76-
paddingEnd="10%"
77-
/>
78-
</Plot>
79-
);
80-
}
81-
return <PlotRefresher />;
46+
useEffect(() => {
47+
const timer = setTimeout(() => {
48+
const [x, y] = generateNewXY(data[data.length - 1], step); // generate a new coordinates
49+
const newData = getLastData([...data, { x, y }], displayInterval); // get last 500s data
50+
setData(newData);
51+
}, refreshFrequency * 1000);
52+
return () => clearTimeout(timer);
53+
}, [data, displayInterval, refreshFrequency, step]);
54+
//const timeFormat = new Intl.DateTimeFormat('en-GB', { timeStyle: 'short' });
55+
return (
56+
<Plot {...DEFAULT_PLOT_CONFIG}>
57+
<Heading title="Nasdaq values Simulation" />
58+
<LineSeries
59+
data={data.map(({ x, y }) => ({ x: x * 1000, y }))}
60+
xAxis="x"
61+
yAxis="y"
62+
lineStyle={{ stroke: 'green', strokeWidth: 1.5 }}
63+
/>
64+
<Axis id="x" position="bottom" label="Time (hh:mm)" scale="time" />
65+
<Axis
66+
id="y"
67+
position="left"
68+
label="Nasdaq value [USD]"
69+
displayPrimaryGridLines
70+
paddingStart="10%"
71+
paddingEnd="10%"
72+
/>
73+
</Plot>
74+
);
8275
}

stories/examples/sanplot-big-data.stories.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ function PlotChart({
123123
}
124124

125125
function processSnapPlotData() {
126-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
127-
// @ts-ignore
128126
const input = prepare1DData(data?.spectra?.[0].data);
129127

130128
const sanResult = xNoiseSanPlot(input);
@@ -138,7 +136,7 @@ function processSnapPlotData() {
138136
}
139137
sanPlot[plotKey] = result;
140138
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
141-
// @ts-ignore
139+
// @ts-expect-error
142140
lines[plotKey] = getLine(sanResult[plotKey], result, {
143141
yLogBase: 2,
144142
});

stories/spectra/iv.stories.tsx

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Meta } from '@storybook/react';
2+
import type { MeasurementSelector } from 'base-analysis';
23
import { Analysis, fromBreakdown, fromTransfer } from 'iv-analysis';
34
import { xyToXYObject } from 'ml-spectra-processing';
45
import { useEffect, useState } from 'react';
@@ -12,13 +13,10 @@ export default {
1213

1314
interface BaseExampleProps {
1415
filename: string;
15-
selector: Record<'xLabel' | 'xUnits' | 'yLabel' | 'yUnits', string>;
16+
selector: MeasurementSelector;
1617
yScale: 'linear' | 'log';
1718
processorFunction(text: string): Analysis[];
18-
children(
19-
meta: Record<string, string>,
20-
data: Array<Record<'x' | 'y', number>>,
21-
): React.ReactNode;
19+
children(meta: any, data: Array<Record<'x' | 'y', number>>): React.ReactNode;
2220
}
2321
function BaseExample({
2422
filename,
@@ -40,7 +38,6 @@ function BaseExample({
4038
if (!csv) return <div>Loading...</div>;
4139

4240
const [analysis] = processorFunction(csv);
43-
// @ts-expect-error See https://github.com/cheminfo/analysis/issues/17
4441
const { variables, meta } = analysis.getMeasurementXY(selector);
4542
const y =
4643
yScale === 'log'
@@ -67,10 +64,14 @@ export function TransferExample() {
6764
<BaseExample
6865
filename="/iv_transfer.csv"
6966
selector={{
70-
xLabel: 'Vg',
71-
xUnits: 'V',
72-
yLabel: 'Id_dens',
73-
yUnits: 'A/mm',
67+
x: {
68+
units: 'V',
69+
label: 'Vg',
70+
},
71+
y: {
72+
units: 'A/mm',
73+
label: 'Id_dens',
74+
},
7475
}}
7576
yScale="log"
7677
processorFunction={fromTransfer}
@@ -115,10 +116,14 @@ export function BreakdownExample() {
115116
<BaseExample
116117
filename="/iv_breakdown.csv"
117118
selector={{
118-
xLabel: 'Vd',
119-
xUnits: 'V',
120-
yLabel: 'Id_dens',
121-
yUnits: 'A/mm',
119+
x: {
120+
units: 'V',
121+
label: 'Vd',
122+
},
123+
y: {
124+
units: 'A/mm',
125+
label: 'Id_dens',
126+
},
122127
}}
123128
yScale="log"
124129
processorFunction={fromBreakdown}

0 commit comments

Comments
 (0)