Skip to content

Commit 3c80c73

Browse files
committed
dist folder
1 parent 7b89366 commit 3c80c73

7 files changed

Lines changed: 179 additions & 53 deletions

File tree

dist/components/d3_line_rect/index.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const waveLengthSelect = (classes, hplcMsSt, updateWaveLengthAct) => {
117117
}, /*#__PURE__*/_react.default.createElement(_material.InputLabel, {
118118
id: "select-decimal-label",
119119
className: (0, _classnames.default)(classes.selectLabel, 'select-sv-bar-label')
120-
}, "Wavelength"), /*#__PURE__*/_react.default.createElement(_material.Select, {
120+
}, "Wavelength (nm)"), /*#__PURE__*/_react.default.createElement(_material.Select, {
121121
labelId: "select-decimal-label",
122122
label: "Decimal",
123123
value: selectedWaveLength,
@@ -271,6 +271,7 @@ class ViewerLineRect extends _react.default.Component {
271271
filterSeed: uvvisSeed,
272272
filterPeak: [],
273273
tTrEndPts,
274+
layoutSt,
274275
isUiNoBrushSt: true,
275276
sweepExtentSt: sweepExtent[0],
276277
integationSt,
@@ -297,6 +298,7 @@ class ViewerLineRect extends _react.default.Component {
297298
filterSeed: [],
298299
filterPeak: [],
299300
tTrEndPts,
301+
layoutSt,
300302
isUiNoBrushSt: true,
301303
sweepExtentSt: sweepExtent[2]
302304
});
@@ -412,6 +414,7 @@ class ViewerLineRect extends _react.default.Component {
412414
filterSeed: subSeed,
413415
filterPeak: [],
414416
tTrEndPts: curTrEndPts,
417+
layoutSt,
415418
isUiNoBrushSt: true,
416419
sweepExtentSt: sweepExtent[2],
417420
uiSt
@@ -527,20 +530,18 @@ class ViewerLineRect extends _react.default.Component {
527530
}
528531
};
529532
const handleWaveLengthChange = event => {
530-
[0, 1, 2].forEach(gi => {
531-
zoomInAct({
532-
graphIndex: gi,
533-
sweepType: _list_ui.LIST_UI_SWEEP_TYPE.ZOOMRESET
534-
});
535-
});
536533
selectWavelengthAct(event);
537534
};
538535
return /*#__PURE__*/_react.default.createElement("div", null, zoomView(classes, 0, uiSt, zoomInAct), waveLengthSelect(classes, hplcMsSt, handleWaveLengthChange), /*#__PURE__*/_react.default.createElement(_integration.default, null), /*#__PURE__*/_react.default.createElement(_peak.default, null), /*#__PURE__*/_react.default.createElement("div", {
539536
className: _list_graph.LIST_ROOT_SVG_GRAPH.LINE
540-
}), /*#__PURE__*/_react.default.createElement(_peak_group.default, {
537+
}), zoomView(classes, 1, uiSt, zoomInAct), ticSelect(classes, hplcMsSt, handleTicChanged), /*#__PURE__*/_react.default.createElement("span", {
538+
style: {
539+
display: 'inline-flex'
540+
}
541+
}, /*#__PURE__*/_react.default.createElement(_peak_group.default, {
541542
feature: feature,
542543
graphIndex: 1
543-
}), zoomView(classes, 1, uiSt, zoomInAct), ticSelect(classes, hplcMsSt, handleTicChanged), /*#__PURE__*/_react.default.createElement("div", {
544+
})), /*#__PURE__*/_react.default.createElement("div", {
544545
className: _list_graph.LIST_ROOT_SVG_GRAPH.MULTI
545546
}), zoomView(classes, 2, uiSt, zoomInAct), /*#__PURE__*/_react.default.createElement(_r03_threshold.default, null), /*#__PURE__*/_react.default.createElement("div", {
546547
className: _list_graph.LIST_ROOT_SVG_GRAPH.RECT

dist/components/d3_line_rect/line_focus.js

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ class LineFocus {
8282
prevLySt,
8383
prevItSt,
8484
prevTePt,
85-
prevData
85+
prevData,
86+
prevDataSig,
87+
prevIntegrationSig,
88+
prevSpectrumKey
8689
} = this.shouldUpdate;
8790
const {
8891
xt,
@@ -94,13 +97,31 @@ class LineFocus {
9497
const currentSpectrum = hplcMsSt?.uvvis?.currentSpectrum;
9598
const sameItSt = prevItSt === currentSpectrum?.integrations?.length;
9699
const sameData = prevData === this.data.length;
100+
const firstPt = this.data[0];
101+
const lastPt = this.data[this.data.length - 1];
102+
const dataSig = `${this.data.length}-${firstPt?.y ?? ''}-${lastPt?.y ?? ''}`;
103+
const sameDataSig = prevDataSig === dataSig;
104+
const spectrumKey = currentSpectrum?.pageValue ?? hplcMsSt?.uvvis?.selectedWaveLength ?? '';
105+
const sameSpectrumKey = prevSpectrumKey === spectrumKey;
106+
const integrations = currentSpectrum?.integrations || [];
107+
const firstIntegration = integrations[0];
108+
const lastIntegration = integrations[integrations.length - 1];
109+
const integrationSig = `${integrations.length}-${firstIntegration?.xL ?? ''}-${firstIntegration?.xU ?? ''}-${lastIntegration?.xL ?? ''}-${lastIntegration?.xU ?? ''}-${currentSpectrum?.refArea ?? ''}-${currentSpectrum?.refFactor ?? ''}`;
110+
const sameIntegrationSig = prevIntegrationSig === integrationSig;
97111
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
98112
sameXY,
99113
sameLySt,
100114
// eslint-disable-line
101115
sameTePt,
102116
sameData,
103-
sameItSt // eslint-disable-line
117+
sameItSt,
118+
sameDataSig,
119+
sameIntegrationSig,
120+
sameSpectrumKey,
121+
// eslint-disable-line
122+
dataSig,
123+
integrationSig,
124+
spectrumKey // eslint-disable-line
104125
});
105126
}
106127
resetShouldUpdate(hplcMsSt) {
@@ -115,14 +136,25 @@ class LineFocus {
115136
const prevLySt = this.layout;
116137
const currentSpectrum = hplcMsSt?.uvvis?.currentSpectrum;
117138
const prevItSt = currentSpectrum?.integrations?.length;
139+
const firstPt = this.data[0];
140+
const lastPt = this.data[this.data.length - 1];
141+
const prevDataSig = `${this.data.length}-${firstPt?.y ?? ''}-${lastPt?.y ?? ''}`;
142+
const spectrumKey = currentSpectrum?.pageValue ?? hplcMsSt?.uvvis?.selectedWaveLength ?? '';
143+
const integrations = currentSpectrum?.integrations || [];
144+
const firstIntegration = integrations[0];
145+
const lastIntegration = integrations[integrations.length - 1];
146+
const prevIntegrationSig = `${integrations.length}-${firstIntegration?.xL ?? ''}-${firstIntegration?.xU ?? ''}-${lastIntegration?.xL ?? ''}-${lastIntegration?.xU ?? ''}-${currentSpectrum?.refArea ?? ''}-${currentSpectrum?.refFactor ?? ''}`;
118147
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
119148
prevXt,
120149
prevYt,
121150
prevLySt,
122151
// eslint-disable-line
123152
prevTePt,
124153
prevData,
125-
prevItSt // eslint-disable-line
154+
prevItSt,
155+
prevDataSig,
156+
prevIntegrationSig,
157+
prevSpectrumKey: spectrumKey // eslint-disable-line
126158
});
127159
}
128160
setTip() {
@@ -136,8 +168,11 @@ class LineFocus {
136168
y: d.y
137169
}));
138170
this.tTrEndPts = tTrEndPts;
139-
this.layout = layout;
171+
if (layout) {
172+
this.layout = layout;
173+
}
140174
this.editPeakSt = editPeakSt;
175+
this.xOnlyBrush = this.layout === _list_layout.LIST_LAYOUT.LC_MS;
141176
}
142177
updatePathCall(xt, yt) {
143178
this.pathCall = d3.line().x(d => xt(d.x)).y(d => yt(d.y));
@@ -151,12 +186,14 @@ class LineFocus {
151186
xExtent: false,
152187
yExtent: false
153188
};
154-
if (!xExtent || !yExtent) {
189+
if (!xExtent) {
155190
const xes = d3.extent(this.data, d => d.x).sort((a, b) => a - b);
156191
xExtent = {
157192
xL: xes[0],
158193
xU: xes[1]
159194
};
195+
}
196+
if (!yExtent) {
160197
const btm = d3.min(this.data, d => d.y);
161198
const top = d3.max(this.data, d => d.y);
162199
const height = top - btm;
@@ -185,9 +222,10 @@ class LineFocus {
185222
drawLine() {
186223
if (!this.path) return;
187224
const {
188-
sameXY
225+
sameXY,
226+
sameDataSig
189227
} = this.shouldUpdate;
190-
if (sameXY) return;
228+
if (sameXY && sameDataSig) return;
191229
const {
192230
xt,
193231
yt
@@ -252,9 +290,11 @@ class LineFocus {
252290
sameXY,
253291
sameLySt,
254292
sameItSt,
255-
sameData
293+
sameData,
294+
sameIntegrationSig,
295+
sameSpectrumKey
256296
} = this.shouldUpdate;
257-
if (sameXY && sameLySt && sameItSt && sameData) return;
297+
if (sameXY && sameLySt && sameItSt && sameData && sameIntegrationSig && sameSpectrumKey) return;
258298
const isDisable = _cfg.default.btnCmdIntg(this.layout);
259299
const ignoreRef = _format.default.isLCMsLayout(this.layout);
260300
const currentSpectrum = hplcMsSt?.uvvis?.currentSpectrum;

dist/components/d3_line_rect/multi_focus.js

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,61 @@ class MultiFocus {
9494
if (polarity === 'neutral') return '#2980b9';
9595
return '#d35400';
9696
};
97+
getTicLegendEntries = (ticEntities, hplcMsSt) => {
98+
const available = hplcMsSt?.tic?.available;
99+
const selected = hplcMsSt?.tic?.polarity;
100+
const baseEntries = [{
101+
key: 'positive',
102+
label: 'PLUS'
103+
}, {
104+
key: 'negative',
105+
label: 'MINUS'
106+
}, {
107+
key: 'neutral',
108+
label: 'NEUTRAL'
109+
}];
110+
let entries = [];
111+
if (available && typeof available === 'object') {
112+
const filtered = baseEntries.filter(entry => available[entry.key]);
113+
if (filtered.length > 0) entries = filtered;
114+
}
115+
if (entries.length === 0 && Array.isArray(ticEntities)) {
116+
const found = new Set();
117+
ticEntities.forEach(entry => {
118+
const {
119+
polarity
120+
} = (0, _extractEntityLCMS.getLcMsInfo)(entry);
121+
if (polarity) found.add(polarity);
122+
});
123+
if (found.size > 0) {
124+
entries = baseEntries.filter(entry => found.has(entry.key));
125+
}
126+
}
127+
if (entries.length === 0) entries = baseEntries;
128+
return entries.map(entry => ({
129+
...entry,
130+
color: this.colorForPolarity(entry.key),
131+
selected: entry.key === selected
132+
}));
133+
};
134+
drawTicLegend = (ticEntities, hplcMsSt) => {
135+
if (!this.root) return;
136+
this.root.selectAll('.tic-legend').remove();
137+
const entries = this.getTicLegendEntries(ticEntities, hplcMsSt);
138+
if (entries.length === 0) return;
139+
const lineLength = 14;
140+
const lineGap = 6;
141+
const legendX = this.w - 8 - lineLength;
142+
const legendY = 10;
143+
const rowHeight = 14;
144+
const legend = this.root.append('g').attr('class', 'tic-legend');
145+
entries.forEach((entry, idx) => {
146+
const row = legend.append('g').attr('transform', `translate(${legendX}, ${legendY + idx * rowHeight})`);
147+
const opacity = entry.selected ? 1 : 0.35;
148+
row.append('line').attr('x1', 0).attr('x2', lineLength).attr('y1', 0).attr('y2', 0).attr('stroke', entry.color).attr('stroke-width', entry.selected ? 2 : 1).attr('stroke-opacity', opacity).attr('stroke-linecap', 'round');
149+
row.append('text').attr('x', -lineGap).attr('y', 0).attr('dy', '0.32em').attr('text-anchor', 'end').attr('font-family', 'Helvetica').style('font-size', '11px').style('fill', entry.color).style('opacity', opacity).text(entry.label);
150+
});
151+
};
97152
getShouldUpdate() {
98153
const {
99154
prevXt,
@@ -170,8 +225,11 @@ class MultiFocus {
170225
}
171226
});
172227
this.tTrEndPts = tTrEndPts;
173-
this.layout = layout;
228+
if (layout) {
229+
this.layout = layout;
230+
}
174231
this.jcampIdx = jcampIdx;
232+
this.xOnlyBrush = this.layout === _list_layout.LIST_LAYOUT.LC_MS;
175233
}
176234
updatePathCall(xt, yt) {
177235
this.pathCall = d3.line().x(d => xt(d.x)).y(d => yt(d.y));
@@ -185,18 +243,23 @@ class MultiFocus {
185243
xExtent: false,
186244
yExtent: false
187245
};
246+
let allData = null;
188247
if (!xExtent || !yExtent) {
189-
let allData = [...this.data];
248+
allData = [...this.data];
190249
if (this.otherLineData) {
191250
this.otherLineData.forEach(lineData => {
192251
allData = [...allData, ...lineData.data];
193252
});
194253
}
254+
}
255+
if (!xExtent) {
195256
const xes = d3.extent(allData, d => d.x).sort((a, b) => a - b);
196257
xExtent = {
197258
xL: xes[0],
198259
xU: xes[1]
199260
};
261+
}
262+
if (!yExtent) {
200263
const btm = d3.min(allData, d => d.y);
201264
const top = d3.max(allData, d => d.y);
202265
const height = top - btm;
@@ -311,6 +374,7 @@ class MultiFocus {
311374
this.drawLine();
312375
this.drawGrid();
313376
this.drawOtherLines(layoutSt);
377+
this.drawTicLegend(ticEntities, hplcMsSt);
314378
}
315379
(0, _brush.default)(this, false, isUiNoBrushSt, this.brushClass);
316380
this.resetShouldUpdate();
@@ -345,6 +409,7 @@ class MultiFocus {
345409
this.drawLine();
346410
this.drawGrid();
347411
this.drawOtherLines(layoutSt);
412+
this.drawTicLegend(ticEntities, hplcMsSt);
348413
}
349414
(0, _brush.default)(this, false, isUiNoBrushSt, this.brushClass);
350415
this.resetShouldUpdate();

dist/components/d3_line_rect/rect_focus.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class RectFocus {
4040
this.selectUiSweepAct = selectUiSweepAct;
4141
this.scrollUiWheelAct = scrollUiWheelAct;
4242
this.brush = d3.brush();
43+
this.brushX = d3.brushX();
4344
this.axis = null;
4445
this.thresLine = null;
4546
this.grid = null;
@@ -75,10 +76,15 @@ class RectFocus {
7576
this.root.call(this.tip);
7677
}
7778
setDataParams(data, peaks, tTrEndPts, tSfPeaks) {
79+
let layout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
7880
this.data = [...data];
7981
this.dataPks = [...peaks];
8082
this.tTrEndPts = tTrEndPts;
8183
this.tSfPeaks = tSfPeaks;
84+
if (layout) {
85+
this.layout = layout;
86+
}
87+
this.xOnlyBrush = this.layout === _list_layout.LIST_LAYOUT.LC_MS;
8288
const xExtent = d3.extent(this.data, d => d.x);
8389
this.scales.x.domain(xExtent);
8490
}
@@ -188,6 +194,7 @@ class RectFocus {
188194
filterPeak,
189195
tTrEndPts,
190196
tSfPeaks,
197+
layoutSt,
191198
sweepExtentSt,
192199
isUiAddIntgSt,
193200
isUiNoBrushSt
@@ -197,7 +204,7 @@ class RectFocus {
197204
(0, _mount.MountClip)(this);
198205
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
199206
this.setTip();
200-
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
207+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt);
201208
(0, _compass.MountCompass)(this);
202209
this.axis = (0, _mount.MountAxis)(this);
203210
[this.thresLine] = (0, _mount.MountThresLine)(this, 'green');
@@ -221,13 +228,14 @@ class RectFocus {
221228
filterPeak,
222229
tTrEndPts,
223230
tSfPeaks,
231+
layoutSt,
224232
sweepExtentSt,
225233
isUiAddIntgSt,
226234
isUiNoBrushSt,
227235
uiSt
228236
} = _ref2;
229237
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
230-
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
238+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt);
231239
this.uiSt = uiSt;
232240
if (this.data && this.data.length > 0) {
233241
this.setConfig(sweepExtentSt);

0 commit comments

Comments
 (0)