@complat/react-spectra-editor 0.11.3 → 0.11.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/d3_line/line_focus_bk.js +860 -0
- package/dist/components/d3_multi/index_bk.js +240 -0
- package/dist/components/d3_multi/multi_focus_bk.js +550 -0
- package/dist/components/panel/compare_bk.js +370 -0
- package/dist/components/panel/info_bk.js +341 -0
- package/dist/components/panel/multiplicity_bk.js +405 -0
- package/dist/helpers/chem_bk.js +779 -0
- package/dist/helpers/converter_bk.js +106 -0
- package/dist/helpers/format_bk.js +462 -0
- package/dist/index_bk.js +760 -0
- package/dist/layer_content_bk.js +128 -0
- package/dist/layer_prism_bk.js +186 -0
- package/dist/reducers/reducer_edit_peak_bk.js +111 -0
- package/dist/reducers/reducer_integration_bk.js +137 -0
- package/dist/reducers/reducer_jcamp_bk.js +74 -0
- package/dist/reducers/reducer_multiplicity_bk.js +131 -0
- package/dist/reducers/reducer_shift_bk.js +99 -0
- package/dist/sagas/saga_edit_peak_bk.js +84 -0
- package/dist/sagas/saga_multiplicity_bk.js +387 -0
- package/dist/sagas/saga_ui_bk.js +488 -0
- package/package.json +3 -2
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
11
|
+
var _d2 = require('d3');
|
|
12
|
+
|
|
13
|
+
var d3 = _interopRequireWildcard(_d2);
|
|
14
|
+
|
|
15
|
+
var _init = require('../../helpers/init');
|
|
16
|
+
|
|
17
|
+
var _mount = require('../../helpers/mount');
|
|
18
|
+
|
|
19
|
+
var _brush = require('../../helpers/brush');
|
|
20
|
+
|
|
21
|
+
var _brush2 = _interopRequireDefault(_brush);
|
|
22
|
+
|
|
23
|
+
var _compass = require('../../helpers/compass');
|
|
24
|
+
|
|
25
|
+
var _converter = require('../../helpers/converter');
|
|
26
|
+
|
|
27
|
+
var _focus = require('../../helpers/focus');
|
|
28
|
+
|
|
29
|
+
var _integration = require('../../helpers/integration');
|
|
30
|
+
|
|
31
|
+
var _multiplicity_calc = require('../../helpers/multiplicity_calc');
|
|
32
|
+
|
|
33
|
+
var _format = require('../../helpers/format');
|
|
34
|
+
|
|
35
|
+
var _format2 = _interopRequireDefault(_format);
|
|
36
|
+
|
|
37
|
+
var _cfg = require('../../helpers/cfg');
|
|
38
|
+
|
|
39
|
+
var _cfg2 = _interopRequireDefault(_cfg);
|
|
40
|
+
|
|
41
|
+
var _list_layout = require('../../constants/list_layout');
|
|
42
|
+
|
|
43
|
+
var _calc = require('../../helpers/calc');
|
|
44
|
+
|
|
45
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
46
|
+
|
|
47
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
48
|
+
|
|
49
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
50
|
+
|
|
51
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
52
|
+
|
|
53
|
+
var LineFocus = function () {
|
|
54
|
+
function LineFocus(props) {
|
|
55
|
+
_classCallCheck(this, LineFocus);
|
|
56
|
+
|
|
57
|
+
var W = props.W,
|
|
58
|
+
H = props.H,
|
|
59
|
+
clickUiTargetAct = props.clickUiTargetAct,
|
|
60
|
+
selectUiSweepAct = props.selectUiSweepAct,
|
|
61
|
+
scrollUiWheelAct = props.scrollUiWheelAct;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
this.jcampIdx = 0;
|
|
65
|
+
this.rootKlass = '.d3Line';
|
|
66
|
+
this.margin = {
|
|
67
|
+
t: 5,
|
|
68
|
+
b: 40,
|
|
69
|
+
l: 60,
|
|
70
|
+
r: 5
|
|
71
|
+
};
|
|
72
|
+
this.w = W - this.margin.l - this.margin.r;
|
|
73
|
+
this.h = H - this.margin.t - this.margin.b;
|
|
74
|
+
this.clickUiTargetAct = clickUiTargetAct;
|
|
75
|
+
this.selectUiSweepAct = selectUiSweepAct;
|
|
76
|
+
this.scrollUiWheelAct = scrollUiWheelAct;
|
|
77
|
+
this.brush = d3.brush();
|
|
78
|
+
this.brushX = d3.brushX();
|
|
79
|
+
|
|
80
|
+
this.axis = null;
|
|
81
|
+
this.path = null;
|
|
82
|
+
this.thresLineUp = null;
|
|
83
|
+
this.thresLineDw = null;
|
|
84
|
+
this.grid = null;
|
|
85
|
+
this.tags = null;
|
|
86
|
+
this.ref = null;
|
|
87
|
+
this.ccPattern = null;
|
|
88
|
+
this.data = [];
|
|
89
|
+
this.dataPks = [];
|
|
90
|
+
this.tTrEndPts = null;
|
|
91
|
+
this.tSfPeaks = null;
|
|
92
|
+
this.root = null;
|
|
93
|
+
this.svg = null;
|
|
94
|
+
this.axisCall = (0, _init.InitAxisCall)(5);
|
|
95
|
+
this.pathCall = null;
|
|
96
|
+
this.tip = null;
|
|
97
|
+
this.factor = 0.125;
|
|
98
|
+
this.currentExtent = null;
|
|
99
|
+
this.shouldUpdate = {};
|
|
100
|
+
this.freq = false;
|
|
101
|
+
this.layout = _list_layout.LIST_LAYOUT.H1;
|
|
102
|
+
|
|
103
|
+
this.getShouldUpdate = this.getShouldUpdate.bind(this);
|
|
104
|
+
this.resetShouldUpdate = this.resetShouldUpdate.bind(this);
|
|
105
|
+
this.setTip = this.setTip.bind(this);
|
|
106
|
+
this.setDataParams = this.setDataParams.bind(this);
|
|
107
|
+
this.create = this.create.bind(this);
|
|
108
|
+
this.update = this.update.bind(this);
|
|
109
|
+
this.setConfig = this.setConfig.bind(this);
|
|
110
|
+
this.drawLine = this.drawLine.bind(this);
|
|
111
|
+
this.drawThres = this.drawThres.bind(this);
|
|
112
|
+
this.drawGrid = this.drawGrid.bind(this);
|
|
113
|
+
this.drawAUC = this.drawAUC.bind(this);
|
|
114
|
+
this.drawPeaks = this.drawPeaks.bind(this);
|
|
115
|
+
this.drawRef = this.drawRef.bind(this);
|
|
116
|
+
this.drawInteg = this.drawInteg.bind(this);
|
|
117
|
+
this.drawMtply = this.drawMtply.bind(this);
|
|
118
|
+
this.drawComparisons = this.drawComparisons.bind(this);
|
|
119
|
+
this.onClickTarget = this.onClickTarget.bind(this);
|
|
120
|
+
this.mergedPeaks = this.mergedPeaks.bind(this);
|
|
121
|
+
this.isFirefox = typeof InstallTrigger !== 'undefined';
|
|
122
|
+
|
|
123
|
+
this.wavelength = null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
_createClass(LineFocus, [{
|
|
127
|
+
key: 'getShouldUpdate',
|
|
128
|
+
value: function getShouldUpdate(nextEpSt, nextItSt, nextMySt) {
|
|
129
|
+
var _shouldUpdate = this.shouldUpdate,
|
|
130
|
+
prevXt = _shouldUpdate.prevXt,
|
|
131
|
+
prevYt = _shouldUpdate.prevYt,
|
|
132
|
+
prevEpSt = _shouldUpdate.prevEpSt,
|
|
133
|
+
prevLySt = _shouldUpdate.prevLySt,
|
|
134
|
+
prevItSt = _shouldUpdate.prevItSt,
|
|
135
|
+
prevMySt = _shouldUpdate.prevMySt,
|
|
136
|
+
prevTePt = _shouldUpdate.prevTePt,
|
|
137
|
+
prevDtPk = _shouldUpdate.prevDtPk,
|
|
138
|
+
prevSfPk = _shouldUpdate.prevSfPk,
|
|
139
|
+
prevData = _shouldUpdate.prevData;
|
|
140
|
+
|
|
141
|
+
var _TfRescale = (0, _compass.TfRescale)(this),
|
|
142
|
+
xt = _TfRescale.xt,
|
|
143
|
+
yt = _TfRescale.yt;
|
|
144
|
+
|
|
145
|
+
var sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
|
|
146
|
+
var sameEpSt = prevEpSt === nextEpSt;
|
|
147
|
+
var sameLySt = prevLySt === this.layout;
|
|
148
|
+
var sameItSt = prevItSt === nextItSt;
|
|
149
|
+
var sameMySt = prevMySt === nextMySt;
|
|
150
|
+
var sameTePt = prevTePt === this.tTrEndPts.length;
|
|
151
|
+
var sameDtPk = prevDtPk === this.dataPks.length;
|
|
152
|
+
var sameSfPk = prevSfPk === this.tSfPeaks.length;
|
|
153
|
+
var sameData = prevData === this.data.length;
|
|
154
|
+
var sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
|
|
155
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
156
|
+
sameXY: sameXY, sameEpSt: sameEpSt, sameLySt: sameLySt, sameItSt: sameItSt, sameMySt: sameMySt, // eslint-disable-line
|
|
157
|
+
sameTePt: sameTePt, sameDtPk: sameDtPk, sameSfPk: sameSfPk, sameData: sameData, sameRef: sameRef // eslint-disable-line
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: 'resetShouldUpdate',
|
|
162
|
+
value: function resetShouldUpdate(prevEpSt, prevItSt, prevMySt) {
|
|
163
|
+
var _TfRescale2 = (0, _compass.TfRescale)(this),
|
|
164
|
+
xt = _TfRescale2.xt,
|
|
165
|
+
yt = _TfRescale2.yt;
|
|
166
|
+
|
|
167
|
+
var prevXt = xt(1.1);
|
|
168
|
+
var prevYt = yt(1.1);
|
|
169
|
+
var prevTePt = this.tTrEndPts.length;
|
|
170
|
+
var prevDtPk = this.dataPks.length;
|
|
171
|
+
var prevSfPk = this.tSfPeaks.length;
|
|
172
|
+
var prevData = this.data.length;
|
|
173
|
+
var prevLySt = this.layout;
|
|
174
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
175
|
+
prevXt: prevXt, prevYt: prevYt, prevEpSt: prevEpSt, prevLySt: prevLySt, prevItSt: prevItSt, prevMySt: prevMySt, // eslint-disable-line
|
|
176
|
+
prevTePt: prevTePt, prevDtPk: prevDtPk, prevSfPk: prevSfPk, prevData: prevData // eslint-disable-line
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: 'setTip',
|
|
181
|
+
value: function setTip() {
|
|
182
|
+
this.tip = (0, _init.InitTip)();
|
|
183
|
+
this.root.call(this.tip);
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: 'setDataParams',
|
|
187
|
+
value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks, freq, layout, wavelength) {
|
|
188
|
+
this.data = [].concat(_toConsumableArray(data));
|
|
189
|
+
this.dataPks = [].concat(_toConsumableArray(peaks));
|
|
190
|
+
this.tTrEndPts = tTrEndPts;
|
|
191
|
+
this.tSfPeaks = tSfPeaks;
|
|
192
|
+
this.freq = freq;
|
|
193
|
+
this.layout = layout;
|
|
194
|
+
this.wavelength = wavelength;
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: 'updatePathCall',
|
|
198
|
+
value: function updatePathCall(xt, yt) {
|
|
199
|
+
this.pathCall = d3.line().x(function (d) {
|
|
200
|
+
return xt(d.x);
|
|
201
|
+
}).y(function (d) {
|
|
202
|
+
return yt(d.y);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: 'setConfig',
|
|
207
|
+
value: function setConfig(sweepExtentSt) {
|
|
208
|
+
// Domain Calculate
|
|
209
|
+
var _ref = sweepExtentSt || { xExtent: false, yExtent: false },
|
|
210
|
+
xExtent = _ref.xExtent,
|
|
211
|
+
yExtent = _ref.yExtent;
|
|
212
|
+
|
|
213
|
+
if (!xExtent || !yExtent) {
|
|
214
|
+
var xes = d3.extent(this.data, function (d) {
|
|
215
|
+
return d.x;
|
|
216
|
+
}).sort(function (a, b) {
|
|
217
|
+
return a - b;
|
|
218
|
+
});
|
|
219
|
+
xExtent = { xL: xes[0], xU: xes[1] };
|
|
220
|
+
var btm = d3.min(this.data, function (d) {
|
|
221
|
+
return d.y;
|
|
222
|
+
});
|
|
223
|
+
var top = d3.max(this.data, function (d) {
|
|
224
|
+
return d.y;
|
|
225
|
+
});
|
|
226
|
+
var height = top - btm;
|
|
227
|
+
yExtent = {
|
|
228
|
+
yL: btm - this.factor * height,
|
|
229
|
+
yU: top + this.factor * height
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.scales.x.domain([xExtent.xL, xExtent.xU]);
|
|
234
|
+
this.scales.y.domain([yExtent.yL, yExtent.yU]);
|
|
235
|
+
|
|
236
|
+
// rescale for zoom
|
|
237
|
+
|
|
238
|
+
var _TfRescale3 = (0, _compass.TfRescale)(this),
|
|
239
|
+
xt = _TfRescale3.xt,
|
|
240
|
+
yt = _TfRescale3.yt;
|
|
241
|
+
|
|
242
|
+
// Axis Call
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
this.axisCall.x.scale(xt);
|
|
246
|
+
this.axisCall.y.scale(yt);
|
|
247
|
+
|
|
248
|
+
this.currentExtent = { xExtent: xExtent, yExtent: yExtent };
|
|
249
|
+
}
|
|
250
|
+
}, {
|
|
251
|
+
key: 'drawLine',
|
|
252
|
+
value: function drawLine() {
|
|
253
|
+
var _shouldUpdate2 = this.shouldUpdate,
|
|
254
|
+
sameXY = _shouldUpdate2.sameXY,
|
|
255
|
+
sameRef = _shouldUpdate2.sameRef;
|
|
256
|
+
|
|
257
|
+
if (sameXY && sameRef) return;
|
|
258
|
+
|
|
259
|
+
var _TfRescale4 = (0, _compass.TfRescale)(this),
|
|
260
|
+
xt = _TfRescale4.xt,
|
|
261
|
+
yt = _TfRescale4.yt;
|
|
262
|
+
|
|
263
|
+
this.updatePathCall(xt, yt);
|
|
264
|
+
this.path.attr('d', this.pathCall(this.data));
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
key: 'drawThres',
|
|
268
|
+
value: function drawThres() {
|
|
269
|
+
if (this.tTrEndPts.length > 0) {
|
|
270
|
+
this.thresLineUp.attr('d', this.pathCall(this.tTrEndPts));
|
|
271
|
+
this.thresLineUp.attr('visibility', 'visible');
|
|
272
|
+
|
|
273
|
+
var _tTrEndPts = _slicedToArray(this.tTrEndPts, 2),
|
|
274
|
+
left = _tTrEndPts[0],
|
|
275
|
+
right = _tTrEndPts[1];
|
|
276
|
+
|
|
277
|
+
var dwMirrorEndPts = [Object.assign({}, left, { y: -left.y }), Object.assign({}, right, { y: -right.y })];
|
|
278
|
+
this.thresLineDw.attr('d', this.pathCall(dwMirrorEndPts));
|
|
279
|
+
this.thresLineDw.attr('visibility', 'visible');
|
|
280
|
+
} else {
|
|
281
|
+
this.thresLineUp.attr('visibility', 'hidden');
|
|
282
|
+
this.thresLineDw.attr('visibility', 'hidden');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
key: 'drawGrid',
|
|
287
|
+
value: function drawGrid() {
|
|
288
|
+
var sameXY = this.shouldUpdate.sameXY;
|
|
289
|
+
|
|
290
|
+
if (sameXY) return;
|
|
291
|
+
|
|
292
|
+
this.grid.x.call(this.axisCall.x.tickSize(-this.h, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
|
|
293
|
+
this.grid.y.call(this.axisCall.y.tickSize(-this.w, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: 'onClickTarget',
|
|
297
|
+
value: function onClickTarget(data) {
|
|
298
|
+
d3.event.stopPropagation();
|
|
299
|
+
d3.event.preventDefault();
|
|
300
|
+
var onPeak = true;
|
|
301
|
+
this.clickUiTargetAct(data, onPeak);
|
|
302
|
+
}
|
|
303
|
+
}, {
|
|
304
|
+
key: 'mergedPeaks',
|
|
305
|
+
value: function mergedPeaks(editPeakSt) {
|
|
306
|
+
if (!editPeakSt) return this.dataPks;
|
|
307
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
|
|
308
|
+
return this.dataPks;
|
|
309
|
+
}
|
|
310
|
+
}, {
|
|
311
|
+
key: 'drawAUC',
|
|
312
|
+
value: function drawAUC(stack) {
|
|
313
|
+
var _this = this;
|
|
314
|
+
|
|
315
|
+
var _TfRescale5 = (0, _compass.TfRescale)(this),
|
|
316
|
+
xt = _TfRescale5.xt,
|
|
317
|
+
yt = _TfRescale5.yt;
|
|
318
|
+
|
|
319
|
+
var auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
320
|
+
auc.exit().attr('class', 'exit').remove();
|
|
321
|
+
|
|
322
|
+
var integCurve = function integCurve(border) {
|
|
323
|
+
var xL = border.xL,
|
|
324
|
+
xU = border.xU;
|
|
325
|
+
|
|
326
|
+
var ps = _this.data.filter(function (d) {
|
|
327
|
+
return d.x > xL && d.x < xU;
|
|
328
|
+
});
|
|
329
|
+
if (!ps[0]) return null;
|
|
330
|
+
|
|
331
|
+
var point1 = ps[0];
|
|
332
|
+
var point2 = ps[ps.length - 1];
|
|
333
|
+
var slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
|
|
334
|
+
var lastDY = point1.y;
|
|
335
|
+
|
|
336
|
+
return d3.area().x(function (d) {
|
|
337
|
+
return xt(d.x);
|
|
338
|
+
}).y0(function (d, index) {
|
|
339
|
+
if (index > 0) {
|
|
340
|
+
var lastD = ps[index - 1];
|
|
341
|
+
var y = slope * (d.x - lastD.x) + lastDY;
|
|
342
|
+
lastDY = y;
|
|
343
|
+
return yt(y);
|
|
344
|
+
}
|
|
345
|
+
return yt(0);
|
|
346
|
+
}).y1(function (d) {
|
|
347
|
+
return yt(d.y);
|
|
348
|
+
})(ps);
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
auc.enter().append('path').attr('class', 'auc').attr('fill', 'red').attr('stroke', 'none').attr('fill-opacity', 0.2).attr('stroke-width', 2).merge(auc).attr('d', function (d) {
|
|
352
|
+
return integCurve(d);
|
|
353
|
+
}).attr('id', function (d) {
|
|
354
|
+
return 'auc' + (0, _focus.itgIdTag)(d);
|
|
355
|
+
}).on('mouseover', function (d) {
|
|
356
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
357
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
358
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).style('fill', 'blue');
|
|
359
|
+
}).on('mouseout', function (d) {
|
|
360
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'none');
|
|
361
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).style('fill', 'red');
|
|
362
|
+
d3.select('#auc' + (0, _focus.itgIdTag)(d)).style('fill-opacity', 0.2);
|
|
363
|
+
}).on('click', function (d) {
|
|
364
|
+
return _this.onClickTarget(d);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: 'drawPeaks',
|
|
369
|
+
value: function drawPeaks(editPeakSt) {
|
|
370
|
+
var _this2 = this;
|
|
371
|
+
|
|
372
|
+
var _shouldUpdate3 = this.shouldUpdate,
|
|
373
|
+
sameXY = _shouldUpdate3.sameXY,
|
|
374
|
+
sameEpSt = _shouldUpdate3.sameEpSt,
|
|
375
|
+
sameDtPk = _shouldUpdate3.sameDtPk,
|
|
376
|
+
sameSfPk = _shouldUpdate3.sameSfPk;
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
if (!_format2.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
|
|
380
|
+
|
|
381
|
+
// rescale for zoom
|
|
382
|
+
|
|
383
|
+
var _TfRescale6 = (0, _compass.TfRescale)(this),
|
|
384
|
+
xt = _TfRescale6.xt,
|
|
385
|
+
yt = _TfRescale6.yt;
|
|
386
|
+
|
|
387
|
+
var dPks = this.mergedPeaks(editPeakSt);
|
|
388
|
+
|
|
389
|
+
var mpp = this.tags.pPath.selectAll('path').data(dPks);
|
|
390
|
+
mpp.exit().attr('class', 'exit').remove();
|
|
391
|
+
|
|
392
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -0.5, y: -20 }, { x: 0.5, y: -20 }, { x: 0.5, y: 10 }];
|
|
393
|
+
// const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
|
|
394
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
395
|
+
return d.x;
|
|
396
|
+
}).y(function (d) {
|
|
397
|
+
return d.y;
|
|
398
|
+
})(linePath);
|
|
399
|
+
|
|
400
|
+
mpp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-peak').attr('fill', 'red').attr('stroke', 'pink').attr('stroke-width', 3).attr('stroke-opacity', 0.0).merge(mpp).attr('id', function (d) {
|
|
401
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
402
|
+
}).attr('transform', function (d) {
|
|
403
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
404
|
+
}).on('mouseover', function (d, i, n) {
|
|
405
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
406
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
407
|
+
var tipParams = { d: d, layout: _this2.layout };
|
|
408
|
+
_this2.tip.show(tipParams, n[i]);
|
|
409
|
+
}).on('mouseout', function (d, i, n) {
|
|
410
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '0.0');
|
|
411
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'red');
|
|
412
|
+
var tipParams = { d: d, layout: _this2.layout };
|
|
413
|
+
_this2.tip.hide(tipParams, n[i]);
|
|
414
|
+
}).on('click', function (d) {
|
|
415
|
+
return _this2.onClickTarget(d);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
var ignoreRef = _format2.default.isHplcUvVisLayout(this.layout);
|
|
419
|
+
if (ignoreRef) {
|
|
420
|
+
var bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
|
|
421
|
+
bpTxt.exit().attr('class', 'exit').remove();
|
|
422
|
+
|
|
423
|
+
bpTxt.enter().append('text').attr('class', 'peak-text').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(bpTxt).attr('id', function (d) {
|
|
424
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
425
|
+
}).text(function (d) {
|
|
426
|
+
return d.x.toFixed(2);
|
|
427
|
+
}).attr('transform', function (d) {
|
|
428
|
+
return 'translate(' + xt(d.x) + ', ' + (yt(d.y) - 25) + ')';
|
|
429
|
+
}).on('click', function (d) {
|
|
430
|
+
return _this2.onClickTarget(d);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}, {
|
|
435
|
+
key: 'drawInteg',
|
|
436
|
+
value: function drawInteg(integationSt) {
|
|
437
|
+
var _this3 = this;
|
|
438
|
+
|
|
439
|
+
var _shouldUpdate4 = this.shouldUpdate,
|
|
440
|
+
sameXY = _shouldUpdate4.sameXY,
|
|
441
|
+
sameLySt = _shouldUpdate4.sameLySt,
|
|
442
|
+
sameItSt = _shouldUpdate4.sameItSt,
|
|
443
|
+
sameData = _shouldUpdate4.sameData;
|
|
444
|
+
|
|
445
|
+
if (sameXY && sameLySt && sameItSt && sameData) return;
|
|
446
|
+
var stack = integationSt.stack,
|
|
447
|
+
refArea = integationSt.refArea,
|
|
448
|
+
refFactor = integationSt.refFactor,
|
|
449
|
+
shift = integationSt.shift;
|
|
450
|
+
|
|
451
|
+
var isDisable = _cfg2.default.btnCmdIntg(this.layout);
|
|
452
|
+
var ignoreRef = _format2.default.isHplcUvVisLayout(this.layout);
|
|
453
|
+
var itgs = isDisable ? [] : stack;
|
|
454
|
+
|
|
455
|
+
var igbp = this.tags.igbPath.selectAll('path').data(itgs);
|
|
456
|
+
igbp.exit().attr('class', 'exit').remove();
|
|
457
|
+
var igcp = this.tags.igcPath.selectAll('path').data(itgs);
|
|
458
|
+
igcp.exit().attr('class', 'exit').remove();
|
|
459
|
+
|
|
460
|
+
var igtp = this.tags.igtPath.selectAll('text').data(itgs);
|
|
461
|
+
igtp.exit().attr('class', 'exit').remove();
|
|
462
|
+
|
|
463
|
+
if (itgs.length === 0 || isDisable) {
|
|
464
|
+
// remove drawn area under curve
|
|
465
|
+
var auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
466
|
+
auc.exit().attr('class', 'exit').remove();
|
|
467
|
+
auc.merge(auc);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (ignoreRef) {
|
|
472
|
+
this.drawAUC(stack);
|
|
473
|
+
} else {
|
|
474
|
+
|
|
475
|
+
// rescale for zoom
|
|
476
|
+
var _TfRescale7 = (0, _compass.TfRescale)(this),
|
|
477
|
+
xt = _TfRescale7.xt;
|
|
478
|
+
|
|
479
|
+
var dh = 50;
|
|
480
|
+
var integBar = function integBar(data) {
|
|
481
|
+
return d3.line()([[xt(data.xL - shift), dh], [xt(data.xL - shift), dh - 10], [xt(data.xL - shift), dh - 5], [xt(data.xU - shift), dh - 5], [xt(data.xU - shift), dh - 10], [xt(data.xU - shift), dh]]);
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
igbp.enter().append('path').attr('class', 'igbp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igbp).attr('id', function (d) {
|
|
485
|
+
return 'igbp' + (0, _focus.itgIdTag)(d);
|
|
486
|
+
}).attr('d', function (d) {
|
|
487
|
+
return integBar(d);
|
|
488
|
+
}).on('mouseover', function (d) {
|
|
489
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
490
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
491
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', 'blue');
|
|
492
|
+
}).on('mouseout', function (d) {
|
|
493
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
494
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
495
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', '#228B22');
|
|
496
|
+
}).on('click', function (d) {
|
|
497
|
+
return _this3.onClickTarget(d);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
var integCurve = function integCurve(border) {
|
|
501
|
+
var xL = border.xL,
|
|
502
|
+
xU = border.xU;
|
|
503
|
+
var nXL = xL - shift,
|
|
504
|
+
nXU = xU - shift;
|
|
505
|
+
|
|
506
|
+
var ps = _this3.data.filter(function (d) {
|
|
507
|
+
return d.x > nXL && d.x < nXU;
|
|
508
|
+
});
|
|
509
|
+
var kMax = _this3.data[_this3.data.length - 1].k;
|
|
510
|
+
if (!ps[0]) return null;
|
|
511
|
+
var kRef = ps[0].k;
|
|
512
|
+
if (!_this3.reverseXAxis(_this3.layout)) {
|
|
513
|
+
return d3.line().x(function (d) {
|
|
514
|
+
return xt(d.x);
|
|
515
|
+
}).y(function (d) {
|
|
516
|
+
return 100 - (kRef - d.k) * 400 / kMax;
|
|
517
|
+
})(ps);
|
|
518
|
+
}
|
|
519
|
+
return d3.line().x(function (d) {
|
|
520
|
+
return xt(d.x);
|
|
521
|
+
}).y(function (d) {
|
|
522
|
+
return 300 - (d.k - kRef) * 400 / kMax;
|
|
523
|
+
})(ps);
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
igcp.enter().append('path').attr('class', 'igcp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igcp).attr('id', function (d) {
|
|
527
|
+
return 'igbc' + (0, _focus.itgIdTag)(d);
|
|
528
|
+
}).attr('d', function (d) {
|
|
529
|
+
return integCurve(d);
|
|
530
|
+
}).on('mouseover', function (d) {
|
|
531
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
532
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
533
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', 'blue');
|
|
534
|
+
}).on('mouseout', function (d) {
|
|
535
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
536
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
537
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', '#228B22');
|
|
538
|
+
}).on('click', function (d) {
|
|
539
|
+
return _this3.onClickTarget(d);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
igtp.enter().append('text').attr('class', 'igtp').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(igtp).attr('id', function (d) {
|
|
543
|
+
return 'igtp' + (0, _focus.itgIdTag)(d);
|
|
544
|
+
}).text(function (d) {
|
|
545
|
+
return (0, _integration.calcArea)(d, refArea, refFactor, ignoreRef);
|
|
546
|
+
}).attr('transform', function (d) {
|
|
547
|
+
return 'translate(' + xt((d.xL + d.xU) / 2 - shift) + ', ' + (dh - 12) + ')';
|
|
548
|
+
}).on('mouseover', function (d) {
|
|
549
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
550
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', 'blue');
|
|
551
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', 'blue');
|
|
552
|
+
}).on('mouseout', function (d) {
|
|
553
|
+
d3.select('#igbp' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
554
|
+
d3.select('#igbc' + (0, _focus.itgIdTag)(d)).attr('stroke', '#228B22');
|
|
555
|
+
d3.select('#igtp' + (0, _focus.itgIdTag)(d)).style('fill', '#228B22');
|
|
556
|
+
}).on('click', function (d) {
|
|
557
|
+
return _this3.onClickTarget(d);
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}, {
|
|
562
|
+
key: 'drawMtply',
|
|
563
|
+
value: function drawMtply(mtplySt) {
|
|
564
|
+
var _ref2,
|
|
565
|
+
_this4 = this;
|
|
566
|
+
|
|
567
|
+
var _shouldUpdate5 = this.shouldUpdate,
|
|
568
|
+
sameXY = _shouldUpdate5.sameXY,
|
|
569
|
+
sameLySt = _shouldUpdate5.sameLySt,
|
|
570
|
+
sameMySt = _shouldUpdate5.sameMySt;
|
|
571
|
+
|
|
572
|
+
if (sameXY && sameLySt && sameMySt) return;
|
|
573
|
+
|
|
574
|
+
var stack = mtplySt.stack,
|
|
575
|
+
smExtext = mtplySt.smExtext,
|
|
576
|
+
shift = mtplySt.shift;
|
|
577
|
+
|
|
578
|
+
var mpys = stack;
|
|
579
|
+
var isDisable = _cfg2.default.btnCmdMpy(this.layout);
|
|
580
|
+
if (mpys === 0 || isDisable) return;
|
|
581
|
+
// rescale for zoom
|
|
582
|
+
|
|
583
|
+
var _TfRescale8 = (0, _compass.TfRescale)(this),
|
|
584
|
+
xt = _TfRescale8.xt;
|
|
585
|
+
|
|
586
|
+
var mpyb = this.tags.mpybPath.selectAll('path').data(mpys);
|
|
587
|
+
mpyb.exit().attr('class', 'exit').remove();
|
|
588
|
+
var mpyt1 = this.tags.mpyt1Path.selectAll('text').data(mpys);
|
|
589
|
+
mpyt1.exit().attr('class', 'exit').remove();
|
|
590
|
+
var mpyt2 = this.tags.mpyt2Path.selectAll('text').data(mpys);
|
|
591
|
+
mpyt2.exit().attr('class', 'exit').remove();
|
|
592
|
+
var mPeaks = mpys.map(function (m) {
|
|
593
|
+
var peaks = m.peaks,
|
|
594
|
+
xExtent = m.xExtent;
|
|
595
|
+
|
|
596
|
+
return peaks.map(function (p) {
|
|
597
|
+
return Object.assign({}, p, { xExtent: xExtent });
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
mPeaks = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(mPeaks));
|
|
601
|
+
var mpyp = this.tags.mpypPath.selectAll('path').data(mPeaks);
|
|
602
|
+
mpyp.exit().attr('class', 'exit').remove();
|
|
603
|
+
|
|
604
|
+
var height = this.h;
|
|
605
|
+
var dh = Math.abs(0.06 * height);
|
|
606
|
+
var mpyBar = function mpyBar(data) {
|
|
607
|
+
return d3.line()([[xt(data.xExtent.xL - shift), height - dh], [xt(data.xExtent.xL - shift), height - dh - 10], [xt(data.xExtent.xL - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 10], [xt(data.xExtent.xU - shift), height - dh]]);
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
var mpyColor = function mpyColor(d) {
|
|
611
|
+
var _d$xExtent = d.xExtent,
|
|
612
|
+
xL = _d$xExtent.xL,
|
|
613
|
+
xU = _d$xExtent.xU;
|
|
614
|
+
|
|
615
|
+
return smExtext.xL === xL && smExtext.xU === xU ? 'purple' : '#DA70D6';
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
mpyb.enter().append('path').attr('class', 'mpyb').attr('fill', 'none').attr('stroke-width', 2).merge(mpyb).attr('stroke', function (d) {
|
|
619
|
+
return mpyColor(d);
|
|
620
|
+
}).attr('id', function (d) {
|
|
621
|
+
return 'mpyb' + (0, _focus.mpyIdTag)(d);
|
|
622
|
+
}).attr('d', function (d) {
|
|
623
|
+
return mpyBar(d);
|
|
624
|
+
}).on('mouseover', function (d) {
|
|
625
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
626
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
627
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
628
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
629
|
+
}).on('mouseout', function (d) {
|
|
630
|
+
var dColor = mpyColor(d);
|
|
631
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
632
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
633
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
634
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
635
|
+
}).on('click', function (d) {
|
|
636
|
+
return _this4.onClickTarget(d);
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
mpyt1.enter().append('text').attr('class', 'mpyt1').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt1).attr('fill', function (d) {
|
|
640
|
+
return mpyColor(d);
|
|
641
|
+
}).attr('id', function (d) {
|
|
642
|
+
return 'mpyt1' + (0, _focus.mpyIdTag)(d);
|
|
643
|
+
}).text(function (d) {
|
|
644
|
+
return '' + (0, _multiplicity_calc.calcMpyCenter)(d.peaks, shift, d.mpyType).toFixed(3);
|
|
645
|
+
}).attr('transform', function (d) {
|
|
646
|
+
return 'translate(' + xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift) + ', ' + (height - dh + 12) + ')';
|
|
647
|
+
}).on('mouseover', function (d) {
|
|
648
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
649
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
650
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
651
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
652
|
+
}).on('mouseout', function (d) {
|
|
653
|
+
var dColor = mpyColor(d);
|
|
654
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
655
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
656
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
657
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
658
|
+
}).on('click', function (d) {
|
|
659
|
+
return _this4.onClickTarget(d);
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
mpyt2.enter().append('text').attr('class', 'mpyt2').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt2).attr('fill', function (d) {
|
|
663
|
+
return mpyColor(d);
|
|
664
|
+
}).attr('id', function (d) {
|
|
665
|
+
return 'mpyt2' + (0, _focus.mpyIdTag)(d);
|
|
666
|
+
}).text(function (d) {
|
|
667
|
+
return '(' + d.mpyType + ')';
|
|
668
|
+
}).attr('transform', function (d) {
|
|
669
|
+
return 'translate(' + xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift) + ', ' + (height - dh + 24) + ')';
|
|
670
|
+
}).on('mouseover', function (d) {
|
|
671
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
672
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
673
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
674
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
675
|
+
}).on('mouseout', function (d) {
|
|
676
|
+
var dColor = mpyColor(d);
|
|
677
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
678
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
679
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
680
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
681
|
+
}).on('click', function (d) {
|
|
682
|
+
return _this4.onClickTarget(d);
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
var mpypH = height - dh;
|
|
686
|
+
var mpypPath = function mpypPath(pk) {
|
|
687
|
+
return [{ x: xt(pk.x - shift) - 0.5, y: mpypH - 5 }, { x: xt(pk.x - shift) - 0.5, y: mpypH - 20 }, { x: xt(pk.x - shift) + 0.5, y: mpypH - 20 }, { x: xt(pk.x - shift) + 0.5, y: mpypH - 5 }];
|
|
688
|
+
};
|
|
689
|
+
// const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
|
|
690
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
691
|
+
return d.x;
|
|
692
|
+
}).y(function (d) {
|
|
693
|
+
return d.y;
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
mpyp.enter().append('path').attr('class', 'mpyp').attr('fill', 'none').merge(mpyp).attr('stroke', function (d) {
|
|
697
|
+
return mpyColor(d);
|
|
698
|
+
}).attr('d', function (d) {
|
|
699
|
+
return lineSymbol(mpypPath(d));
|
|
700
|
+
}).attr('id', function (d) {
|
|
701
|
+
return 'mpyp' + (0, _focus.mpyIdTag)(d);
|
|
702
|
+
}).on('mouseover', function (d) {
|
|
703
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
704
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
705
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', 'blue');
|
|
706
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', 'blue');
|
|
707
|
+
}).on('mouseout', function (d) {
|
|
708
|
+
var dColor = mpyColor(d);
|
|
709
|
+
d3.selectAll('#mpyb' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
710
|
+
d3.selectAll('#mpyt1' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
711
|
+
d3.selectAll('#mpyt2' + (0, _focus.mpyIdTag)(d)).style('fill', dColor);
|
|
712
|
+
d3.selectAll('#mpyp' + (0, _focus.mpyIdTag)(d)).attr('stroke', dColor);
|
|
713
|
+
}).on('click', function (d) {
|
|
714
|
+
return _this4.onClickTarget(d);
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}, {
|
|
718
|
+
key: 'drawRef',
|
|
719
|
+
value: function drawRef() {
|
|
720
|
+
// rescale for zoom
|
|
721
|
+
var _TfRescale9 = (0, _compass.TfRescale)(this),
|
|
722
|
+
xt = _TfRescale9.xt,
|
|
723
|
+
yt = _TfRescale9.yt;
|
|
724
|
+
|
|
725
|
+
var ccp = this.ref.selectAll('path').data(this.tSfPeaks);
|
|
726
|
+
|
|
727
|
+
ccp.exit().attr('class', 'exit').remove();
|
|
728
|
+
|
|
729
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -4, y: -20 }, { x: 4, y: -20 }, { x: 0.5, y: 10 }];
|
|
730
|
+
var faktor = _format2.default.isIrLayout(this.layout) ? -1 : 1;
|
|
731
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
732
|
+
return d.x;
|
|
733
|
+
}).y(function (d) {
|
|
734
|
+
return faktor * d.y;
|
|
735
|
+
})(linePath);
|
|
736
|
+
|
|
737
|
+
ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', function (d) {
|
|
738
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}, {
|
|
742
|
+
key: 'drawComparisons',
|
|
743
|
+
value: function drawComparisons(comparisons) {
|
|
744
|
+
var _this5 = this;
|
|
745
|
+
|
|
746
|
+
d3.selectAll('.line-clip-compare').remove();
|
|
747
|
+
if (!comparisons) return null;
|
|
748
|
+
comparisons.forEach(function (c, idx) {
|
|
749
|
+
if (!c.show) return;
|
|
750
|
+
var path = (0, _mount.MountComparePath)(_this5, _format2.default.compareColors(idx), idx); // #D5D8DC
|
|
751
|
+
path.attr('d', _this5.pathCall(c.data));
|
|
752
|
+
});
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
}, {
|
|
756
|
+
key: 'reverseXAxis',
|
|
757
|
+
value: function reverseXAxis(layoutSt) {
|
|
758
|
+
return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY].indexOf(layoutSt) < 0;
|
|
759
|
+
}
|
|
760
|
+
}, {
|
|
761
|
+
key: 'create',
|
|
762
|
+
value: function create(_ref3) {
|
|
763
|
+
var filterSeed = _ref3.filterSeed,
|
|
764
|
+
filterPeak = _ref3.filterPeak,
|
|
765
|
+
tTrEndPts = _ref3.tTrEndPts,
|
|
766
|
+
tSfPeaks = _ref3.tSfPeaks,
|
|
767
|
+
freq = _ref3.freq,
|
|
768
|
+
comparisons = _ref3.comparisons,
|
|
769
|
+
editPeakSt = _ref3.editPeakSt,
|
|
770
|
+
layoutSt = _ref3.layoutSt,
|
|
771
|
+
integationSt = _ref3.integationSt,
|
|
772
|
+
mtplySt = _ref3.mtplySt,
|
|
773
|
+
sweepExtentSt = _ref3.sweepExtentSt,
|
|
774
|
+
isUiAddIntgSt = _ref3.isUiAddIntgSt,
|
|
775
|
+
isUiNoBrushSt = _ref3.isUiNoBrushSt,
|
|
776
|
+
wavelength = _ref3.wavelength;
|
|
777
|
+
|
|
778
|
+
this.svg = d3.select('.d3Svg');
|
|
779
|
+
(0, _mount.MountMainFrame)(this, 'focus');
|
|
780
|
+
(0, _mount.MountClip)(this);
|
|
781
|
+
|
|
782
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
783
|
+
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
|
|
784
|
+
this.setTip();
|
|
785
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
|
|
786
|
+
(0, _compass.MountCompass)(this);
|
|
787
|
+
|
|
788
|
+
this.axis = (0, _mount.MountAxis)(this);
|
|
789
|
+
this.path = (0, _mount.MountPath)(this, 'steelblue');
|
|
790
|
+
|
|
791
|
+
var _MountThresLine = (0, _mount.MountThresLine)(this, 'green');
|
|
792
|
+
|
|
793
|
+
var _MountThresLine2 = _slicedToArray(_MountThresLine, 2);
|
|
794
|
+
|
|
795
|
+
this.thresLineUp = _MountThresLine2[0];
|
|
796
|
+
this.thresLineDw = _MountThresLine2[1];
|
|
797
|
+
|
|
798
|
+
this.grid = (0, _mount.MountGrid)(this);
|
|
799
|
+
this.tags = (0, _mount.MountTags)(this);
|
|
800
|
+
this.ref = (0, _mount.MountRef)(this);
|
|
801
|
+
(0, _mount.MountAxisLabelX)(this);
|
|
802
|
+
(0, _mount.MountAxisLabelY)(this);
|
|
803
|
+
|
|
804
|
+
if (this.data && this.data.length > 0) {
|
|
805
|
+
this.setConfig(sweepExtentSt);
|
|
806
|
+
this.drawLine();
|
|
807
|
+
this.drawThres();
|
|
808
|
+
this.drawGrid();
|
|
809
|
+
this.drawRef();
|
|
810
|
+
this.drawPeaks(editPeakSt);
|
|
811
|
+
this.drawInteg(integationSt);
|
|
812
|
+
this.drawMtply(mtplySt);
|
|
813
|
+
this.drawComparisons(comparisons);
|
|
814
|
+
}
|
|
815
|
+
(0, _brush2.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
816
|
+
this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
|
|
817
|
+
}
|
|
818
|
+
}, {
|
|
819
|
+
key: 'update',
|
|
820
|
+
value: function update(_ref4) {
|
|
821
|
+
var filterSeed = _ref4.filterSeed,
|
|
822
|
+
filterPeak = _ref4.filterPeak,
|
|
823
|
+
tTrEndPts = _ref4.tTrEndPts,
|
|
824
|
+
tSfPeaks = _ref4.tSfPeaks,
|
|
825
|
+
freq = _ref4.freq,
|
|
826
|
+
comparisons = _ref4.comparisons,
|
|
827
|
+
editPeakSt = _ref4.editPeakSt,
|
|
828
|
+
layoutSt = _ref4.layoutSt,
|
|
829
|
+
integationSt = _ref4.integationSt,
|
|
830
|
+
mtplySt = _ref4.mtplySt,
|
|
831
|
+
sweepExtentSt = _ref4.sweepExtentSt,
|
|
832
|
+
isUiAddIntgSt = _ref4.isUiAddIntgSt,
|
|
833
|
+
isUiNoBrushSt = _ref4.isUiNoBrushSt,
|
|
834
|
+
wavelength = _ref4.wavelength;
|
|
835
|
+
|
|
836
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
837
|
+
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
|
|
838
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
|
|
839
|
+
|
|
840
|
+
if (this.data && this.data.length > 0) {
|
|
841
|
+
this.setConfig(sweepExtentSt);
|
|
842
|
+
this.getShouldUpdate(editPeakSt, integationSt, mtplySt);
|
|
843
|
+
this.drawLine();
|
|
844
|
+
this.drawThres();
|
|
845
|
+
this.drawGrid();
|
|
846
|
+
this.drawRef();
|
|
847
|
+
this.drawPeaks(editPeakSt);
|
|
848
|
+
this.drawInteg(integationSt);
|
|
849
|
+
this.drawMtply(mtplySt);
|
|
850
|
+
this.drawComparisons(comparisons);
|
|
851
|
+
}
|
|
852
|
+
(0, _brush2.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
853
|
+
this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
|
|
854
|
+
}
|
|
855
|
+
}]);
|
|
856
|
+
|
|
857
|
+
return LineFocus;
|
|
858
|
+
}();
|
|
859
|
+
|
|
860
|
+
exports.default = LineFocus;
|