@complat/react-spectra-editor 1.0.0-rc2 → 1.0.0-rc20.patch-1

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.
Files changed (202) hide show
  1. package/README.md +16 -0
  2. package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
  3. package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
  4. package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
  5. package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
  6. package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
  7. package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
  8. package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
  9. package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
  10. package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
  11. package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
  12. package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
  13. package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
  14. package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
  15. package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
  16. package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
  17. package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
  18. package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
  19. package/dist/__tests__/fixtures/ir_result.js +46 -0
  20. package/dist/__tests__/fixtures/ir_svg.js +8 -0
  21. package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
  22. package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
  23. package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
  24. package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
  25. package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
  26. package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
  27. package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
  28. package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
  29. package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
  30. package/dist/__tests__/fixtures/nmr_result.js +68 -0
  31. package/dist/__tests__/fixtures/nmr_svg.js +8 -0
  32. package/dist/__tests__/fixtures/phenylalanin.js +142 -0
  33. package/dist/__tests__/fixtures/qDescValue.js +65 -0
  34. package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
  35. package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
  36. package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
  37. package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
  38. package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
  39. package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
  40. package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
  41. package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
  42. package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
  43. package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
  44. package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
  45. package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
  46. package/dist/actions/curve.js +15 -14
  47. package/dist/actions/cyclic_voltammetry.js +40 -60
  48. package/dist/actions/edit_peak.js +8 -12
  49. package/dist/actions/forecast.js +16 -24
  50. package/dist/actions/integration.js +12 -18
  51. package/dist/actions/jcamp.js +16 -24
  52. package/dist/actions/layout.js +4 -6
  53. package/dist/actions/manager.js +20 -30
  54. package/dist/actions/meta.js +4 -6
  55. package/dist/actions/multiplicity.js +24 -36
  56. package/dist/actions/scan.js +12 -18
  57. package/dist/actions/shift.js +8 -12
  58. package/dist/actions/status.js +12 -18
  59. package/dist/actions/submit.js +16 -24
  60. package/dist/actions/threshold.js +20 -30
  61. package/dist/actions/ui.js +25 -31
  62. package/dist/actions/wavelength.js +4 -6
  63. package/dist/app.js +25 -23
  64. package/dist/components/cmd_bar/01_viewer.js +24 -34
  65. package/dist/components/cmd_bar/02_zoom.js +18 -28
  66. package/dist/components/cmd_bar/03_peak.js +50 -66
  67. package/dist/components/cmd_bar/04_integration.js +70 -84
  68. package/dist/components/cmd_bar/05_multiplicity.js +42 -56
  69. package/dist/components/cmd_bar/06_undo_redo.js +22 -36
  70. package/dist/components/cmd_bar/07_pecker.js +24 -34
  71. package/dist/components/cmd_bar/common.js +11 -7
  72. package/dist/components/cmd_bar/index.js +17 -23
  73. package/dist/components/cmd_bar/r01_layout.js +79 -56
  74. package/dist/components/cmd_bar/r02_scan.js +70 -87
  75. package/dist/components/cmd_bar/r03_threshold.js +54 -68
  76. package/dist/components/cmd_bar/r04_submit.js +71 -83
  77. package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
  78. package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
  79. package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
  80. package/dist/components/cmd_bar/tri_btn.js +91 -113
  81. package/dist/components/common/chem.js +2 -3
  82. package/dist/components/common/comps.js +2 -2
  83. package/dist/components/common/draw.js +30 -11
  84. package/dist/components/d3_line/index.js +154 -176
  85. package/dist/components/d3_line/line_focus.js +595 -739
  86. package/dist/components/d3_multi/index.js +153 -174
  87. package/dist/components/d3_multi/multi_focus.js +725 -850
  88. package/dist/components/d3_rect/index.js +112 -134
  89. package/dist/components/d3_rect/rect_focus.js +163 -208
  90. package/dist/components/forecast/comps.js +60 -68
  91. package/dist/components/forecast/ir_comps.js +49 -56
  92. package/dist/components/forecast/ir_viewer.js +61 -68
  93. package/dist/components/forecast/nmr_comps.js +62 -72
  94. package/dist/components/forecast/nmr_viewer.js +59 -68
  95. package/dist/components/forecast/section_loading.js +39 -63
  96. package/dist/components/forecast_viewer.js +109 -119
  97. package/dist/components/multi_jcamps_viewer.js +97 -113
  98. package/dist/components/panel/compare.js +183 -192
  99. package/dist/components/panel/cyclic_voltamery_data.js +149 -165
  100. package/dist/components/panel/graph_selection.js +143 -132
  101. package/dist/components/panel/index.js +112 -144
  102. package/dist/components/panel/info.js +125 -132
  103. package/dist/components/panel/multiplicity.js +215 -223
  104. package/dist/components/panel/multiplicity_coupling.js +108 -136
  105. package/dist/components/panel/multiplicity_select.js +43 -51
  106. package/dist/components/panel/peaks.js +130 -132
  107. package/dist/constants/action_type.js +23 -39
  108. package/dist/constants/list_layout.js +7 -4
  109. package/dist/constants/list_shift.js +117 -103
  110. package/dist/constants/list_ui.js +3 -6
  111. package/dist/constants/list_wavelength.js +7 -8
  112. package/dist/fn.js +2 -3
  113. package/dist/helpers/brush.js +49 -65
  114. package/dist/helpers/calc.js +2 -4
  115. package/dist/helpers/carbonFeatures.js +22 -20
  116. package/dist/helpers/cfg.js +49 -67
  117. package/dist/helpers/chem.js +450 -393
  118. package/dist/helpers/compass.js +92 -83
  119. package/dist/helpers/converter.js +52 -65
  120. package/dist/helpers/extractParams.js +60 -52
  121. package/dist/helpers/extractPeaksEdit.js +29 -25
  122. package/dist/helpers/focus.js +2 -6
  123. package/dist/helpers/format.js +416 -361
  124. package/dist/helpers/init.js +41 -37
  125. package/dist/helpers/integration.js +18 -21
  126. package/dist/helpers/mount.js +57 -61
  127. package/dist/helpers/multiplicity.js +19 -24
  128. package/dist/helpers/multiplicity_calc.js +39 -50
  129. package/dist/helpers/multiplicity_complat.js +21 -47
  130. package/dist/helpers/multiplicity_manual.js +49 -55
  131. package/dist/helpers/multiplicity_verify_basic.js +108 -111
  132. package/dist/helpers/shift.js +15 -23
  133. package/dist/helpers/zoom.js +7 -11
  134. package/dist/index.js +680 -630
  135. package/dist/layer_content.js +40 -43
  136. package/dist/layer_init.js +162 -184
  137. package/dist/layer_prism.js +38 -41
  138. package/dist/reducers/index.js +2 -3
  139. package/dist/reducers/reducer_curve.js +35 -26
  140. package/dist/reducers/reducer_edit_peak.js +122 -98
  141. package/dist/reducers/reducer_forecast.js +57 -44
  142. package/dist/reducers/reducer_integration.js +135 -103
  143. package/dist/reducers/reducer_jcamp.js +49 -44
  144. package/dist/reducers/reducer_layout.js +5 -6
  145. package/dist/reducers/reducer_manager.js +5 -6
  146. package/dist/reducers/reducer_meta.js +5 -6
  147. package/dist/reducers/reducer_multiplicity.js +100 -77
  148. package/dist/reducers/reducer_scan.js +17 -20
  149. package/dist/reducers/reducer_shift.js +115 -70
  150. package/dist/reducers/reducer_simulation.js +7 -8
  151. package/dist/reducers/reducer_status.js +5 -6
  152. package/dist/reducers/reducer_submit.js +12 -15
  153. package/dist/reducers/reducer_threshold.js +5 -6
  154. package/dist/reducers/reducer_ui.js +5 -6
  155. package/dist/reducers/reducer_voltammetry.js +156 -96
  156. package/dist/reducers/reducer_wavelength.js +5 -6
  157. package/dist/reducers/undo_redo_config.js +3 -5
  158. package/dist/sagas/index.js +2 -15
  159. package/dist/sagas/saga_edit_peak.js +54 -68
  160. package/dist/sagas/saga_manager.js +86 -130
  161. package/dist/sagas/saga_meta.js +25 -31
  162. package/dist/sagas/saga_multi_entities.js +40 -103
  163. package/dist/sagas/saga_multiplicity.js +336 -406
  164. package/dist/sagas/saga_ui.js +296 -475
  165. package/dist/setupTests.js +8 -0
  166. package/dist/third_party/jAnalyzer.js +66 -67
  167. package/dist/third_party/peakInterval.js +34 -34
  168. package/package.json +14 -14
  169. package/dist/components/cmd_bar/03_peak_bk.js +0 -139
  170. package/dist/components/cmd_bar/04_integration_bk.js +0 -180
  171. package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
  172. package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
  173. package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
  174. package/dist/components/d3_line/line_focus_bk.js +0 -825
  175. package/dist/components/d3_multi/index_bk.js +0 -210
  176. package/dist/components/d3_multi/multi_focus_bk.js +0 -533
  177. package/dist/components/panel/compare_bk.js +0 -256
  178. package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
  179. package/dist/components/panel/index_bk.js +0 -178
  180. package/dist/components/panel/info_bk.js +0 -235
  181. package/dist/components/panel/multiplicity_bk.js +0 -280
  182. package/dist/helpers/carbonFeatures_bk.js +0 -45
  183. package/dist/helpers/cfg_bk.js +0 -80
  184. package/dist/helpers/chem_bk.js +0 -787
  185. package/dist/helpers/compass_bk.js +0 -149
  186. package/dist/helpers/converter_bk.js +0 -96
  187. package/dist/helpers/extractPeaksEdit_bk.js +0 -53
  188. package/dist/helpers/format_bk.js +0 -497
  189. package/dist/index_bk.js +0 -640
  190. package/dist/layer_content_bk.js +0 -105
  191. package/dist/layer_init_bk.js +0 -235
  192. package/dist/layer_prism_bk.js +0 -133
  193. package/dist/reducers/reducer_edit_peak_bk.js +0 -108
  194. package/dist/reducers/reducer_integration_bk.js +0 -134
  195. package/dist/reducers/reducer_jcamp_bk.js +0 -71
  196. package/dist/reducers/reducer_multiplicity_bk.js +0 -126
  197. package/dist/reducers/reducer_shift_bk.js +0 -88
  198. package/dist/reducers/reducer_voltammetry_bk.js +0 -287
  199. package/dist/sagas/saga_edit_peak_bk.js +0 -73
  200. package/dist/sagas/saga_multi_entities_bk.js +0 -106
  201. package/dist/sagas/saga_multiplicity_bk.js +0 -351
  202. package/dist/sagas/saga_ui_bk.js +0 -453
@@ -1,825 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var d3 = _interopRequireWildcard(require("d3"));
14
- var _init = require("../../helpers/init");
15
- var _mount = require("../../helpers/mount");
16
- var _brush = _interopRequireDefault(require("../../helpers/brush"));
17
- var _compass = require("../../helpers/compass");
18
- var _converter = require("../../helpers/converter");
19
- var _focus = require("../../helpers/focus");
20
- var _integration = require("../../helpers/integration");
21
- var _multiplicity_calc = require("../../helpers/multiplicity_calc");
22
- var _format = _interopRequireDefault(require("../../helpers/format"));
23
- var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
24
- var _list_layout = require("../../constants/list_layout");
25
- var _calc = require("../../helpers/calc");
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
28
- var LineFocus = /*#__PURE__*/function () {
29
- function LineFocus(props) {
30
- (0, _classCallCheck2.default)(this, LineFocus);
31
- var W = props.W,
32
- H = props.H,
33
- clickUiTargetAct = props.clickUiTargetAct,
34
- selectUiSweepAct = props.selectUiSweepAct,
35
- scrollUiWheelAct = props.scrollUiWheelAct;
36
- this.jcampIdx = 0;
37
- this.rootKlass = '.d3Line';
38
- this.margin = {
39
- t: 5,
40
- b: 40,
41
- l: 60,
42
- r: 5
43
- };
44
- this.w = W - this.margin.l - this.margin.r;
45
- this.h = H - this.margin.t - this.margin.b;
46
- this.clickUiTargetAct = clickUiTargetAct;
47
- this.selectUiSweepAct = selectUiSweepAct;
48
- this.scrollUiWheelAct = scrollUiWheelAct;
49
- this.brush = d3.brush();
50
- this.brushX = d3.brushX();
51
- this.axis = null;
52
- this.path = null;
53
- this.thresLineUp = null;
54
- this.thresLineDw = null;
55
- this.grid = null;
56
- this.tags = null;
57
- this.ref = null;
58
- this.ccPattern = null;
59
- this.data = [];
60
- this.dataPks = [];
61
- this.tTrEndPts = null;
62
- this.tSfPeaks = null;
63
- this.root = null;
64
- this.svg = null;
65
- this.axisCall = (0, _init.InitAxisCall)(5);
66
- this.pathCall = null;
67
- this.tip = null;
68
- this.factor = 0.125;
69
- this.currentExtent = null;
70
- this.shouldUpdate = {};
71
- this.freq = false;
72
- this.layout = _list_layout.LIST_LAYOUT.H1;
73
- this.getShouldUpdate = this.getShouldUpdate.bind(this);
74
- this.resetShouldUpdate = this.resetShouldUpdate.bind(this);
75
- this.setTip = this.setTip.bind(this);
76
- this.setDataParams = this.setDataParams.bind(this);
77
- this.create = this.create.bind(this);
78
- this.update = this.update.bind(this);
79
- this.setConfig = this.setConfig.bind(this);
80
- this.drawLine = this.drawLine.bind(this);
81
- this.drawThres = this.drawThres.bind(this);
82
- this.drawGrid = this.drawGrid.bind(this);
83
- this.drawAUC = this.drawAUC.bind(this);
84
- this.drawPeaks = this.drawPeaks.bind(this);
85
- this.drawRef = this.drawRef.bind(this);
86
- this.drawInteg = this.drawInteg.bind(this);
87
- this.drawMtply = this.drawMtply.bind(this);
88
- this.drawComparisons = this.drawComparisons.bind(this);
89
- this.onClickTarget = this.onClickTarget.bind(this);
90
- this.mergedPeaks = this.mergedPeaks.bind(this);
91
- this.isFirefox = typeof InstallTrigger !== 'undefined';
92
- this.wavelength = null;
93
- }
94
- (0, _createClass2.default)(LineFocus, [{
95
- key: "getShouldUpdate",
96
- value: function getShouldUpdate(nextEpSt, nextItSt, nextMySt) {
97
- var _this$shouldUpdate = this.shouldUpdate,
98
- prevXt = _this$shouldUpdate.prevXt,
99
- prevYt = _this$shouldUpdate.prevYt,
100
- prevEpSt = _this$shouldUpdate.prevEpSt,
101
- prevLySt = _this$shouldUpdate.prevLySt,
102
- prevItSt = _this$shouldUpdate.prevItSt,
103
- prevMySt = _this$shouldUpdate.prevMySt,
104
- prevTePt = _this$shouldUpdate.prevTePt,
105
- prevDtPk = _this$shouldUpdate.prevDtPk,
106
- prevSfPk = _this$shouldUpdate.prevSfPk,
107
- prevData = _this$shouldUpdate.prevData;
108
- var _TfRescale = (0, _compass.TfRescale)(this),
109
- xt = _TfRescale.xt,
110
- yt = _TfRescale.yt;
111
- var sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
112
- var sameEpSt = prevEpSt === nextEpSt;
113
- var sameLySt = prevLySt === this.layout;
114
- var sameItSt = prevItSt === nextItSt;
115
- var sameMySt = prevMySt === nextMySt;
116
- var sameTePt = prevTePt === this.tTrEndPts.length;
117
- var sameDtPk = prevDtPk === this.dataPks.length;
118
- var sameSfPk = prevSfPk === this.tSfPeaks.length;
119
- var sameData = prevData === this.data.length;
120
- var sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
121
- this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
122
- sameXY: sameXY,
123
- sameEpSt: sameEpSt,
124
- sameLySt: sameLySt,
125
- sameItSt: sameItSt,
126
- sameMySt: sameMySt,
127
- // eslint-disable-line
128
- sameTePt: sameTePt,
129
- sameDtPk: sameDtPk,
130
- sameSfPk: sameSfPk,
131
- sameData: sameData,
132
- sameRef: sameRef // eslint-disable-line
133
- });
134
- }
135
- }, {
136
- key: "resetShouldUpdate",
137
- value: function resetShouldUpdate(prevEpSt, prevItSt, prevMySt) {
138
- var _TfRescale2 = (0, _compass.TfRescale)(this),
139
- xt = _TfRescale2.xt,
140
- yt = _TfRescale2.yt;
141
- var prevXt = xt(1.1);
142
- var prevYt = yt(1.1);
143
- var prevTePt = this.tTrEndPts.length;
144
- var prevDtPk = this.dataPks.length;
145
- var prevSfPk = this.tSfPeaks.length;
146
- var prevData = this.data.length;
147
- var prevLySt = this.layout;
148
- this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
149
- prevXt: prevXt,
150
- prevYt: prevYt,
151
- prevEpSt: prevEpSt,
152
- prevLySt: prevLySt,
153
- prevItSt: prevItSt,
154
- prevMySt: prevMySt,
155
- // eslint-disable-line
156
- prevTePt: prevTePt,
157
- prevDtPk: prevDtPk,
158
- prevSfPk: prevSfPk,
159
- prevData: prevData // eslint-disable-line
160
- });
161
- }
162
- }, {
163
- key: "setTip",
164
- value: function setTip() {
165
- this.tip = (0, _init.InitTip)();
166
- this.root.call(this.tip);
167
- }
168
- }, {
169
- key: "setDataParams",
170
- value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks, freq, layout, wavelength) {
171
- this.data = (0, _toConsumableArray2.default)(data);
172
- this.dataPks = (0, _toConsumableArray2.default)(peaks);
173
- this.tTrEndPts = tTrEndPts;
174
- this.tSfPeaks = tSfPeaks;
175
- this.freq = freq;
176
- this.layout = layout;
177
- this.wavelength = wavelength;
178
- }
179
- }, {
180
- key: "updatePathCall",
181
- value: function updatePathCall(xt, yt) {
182
- this.pathCall = d3.line().x(function (d) {
183
- return xt(d.x);
184
- }).y(function (d) {
185
- return yt(d.y);
186
- });
187
- }
188
- }, {
189
- key: "setConfig",
190
- value: function setConfig(sweepExtentSt) {
191
- // Domain Calculate
192
- var _ref = sweepExtentSt || {
193
- xExtent: false,
194
- yExtent: false
195
- },
196
- xExtent = _ref.xExtent,
197
- yExtent = _ref.yExtent;
198
- if (!xExtent || !yExtent) {
199
- var xes = d3.extent(this.data, function (d) {
200
- return d.x;
201
- }).sort(function (a, b) {
202
- return a - b;
203
- });
204
- xExtent = {
205
- xL: xes[0],
206
- xU: xes[1]
207
- };
208
- var btm = d3.min(this.data, function (d) {
209
- return d.y;
210
- });
211
- var top = d3.max(this.data, function (d) {
212
- return d.y;
213
- });
214
- var height = top - btm;
215
- yExtent = {
216
- yL: btm - this.factor * height,
217
- yU: top + this.factor * height
218
- };
219
- }
220
- this.scales.x.domain([xExtent.xL, xExtent.xU]);
221
- this.scales.y.domain([yExtent.yL, yExtent.yU]);
222
-
223
- // rescale for zoom
224
- var _TfRescale3 = (0, _compass.TfRescale)(this),
225
- xt = _TfRescale3.xt,
226
- yt = _TfRescale3.yt;
227
-
228
- // Axis Call
229
- this.axisCall.x.scale(xt);
230
- this.axisCall.y.scale(yt);
231
- this.currentExtent = {
232
- xExtent: xExtent,
233
- yExtent: yExtent
234
- };
235
- }
236
- }, {
237
- key: "drawLine",
238
- value: function drawLine() {
239
- var _this$shouldUpdate2 = this.shouldUpdate,
240
- sameXY = _this$shouldUpdate2.sameXY,
241
- sameRef = _this$shouldUpdate2.sameRef;
242
- if (sameXY && sameRef) return;
243
- var _TfRescale4 = (0, _compass.TfRescale)(this),
244
- xt = _TfRescale4.xt,
245
- yt = _TfRescale4.yt;
246
- this.updatePathCall(xt, yt);
247
- this.path.attr('d', this.pathCall(this.data));
248
- }
249
- }, {
250
- key: "drawThres",
251
- value: function drawThres() {
252
- if (this.tTrEndPts.length > 0) {
253
- this.thresLineUp.attr('d', this.pathCall(this.tTrEndPts));
254
- this.thresLineUp.attr('visibility', 'visible');
255
- var _this$tTrEndPts = (0, _slicedToArray2.default)(this.tTrEndPts, 2),
256
- left = _this$tTrEndPts[0],
257
- right = _this$tTrEndPts[1];
258
- var dwMirrorEndPts = [Object.assign({}, left, {
259
- y: -left.y
260
- }), Object.assign({}, right, {
261
- y: -right.y
262
- })];
263
- this.thresLineDw.attr('d', this.pathCall(dwMirrorEndPts));
264
- this.thresLineDw.attr('visibility', 'visible');
265
- } else {
266
- this.thresLineUp.attr('visibility', 'hidden');
267
- this.thresLineDw.attr('visibility', 'hidden');
268
- }
269
- }
270
- }, {
271
- key: "drawGrid",
272
- value: function drawGrid() {
273
- var sameXY = this.shouldUpdate.sameXY;
274
- if (sameXY) return;
275
- 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');
276
- 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');
277
- }
278
- }, {
279
- key: "onClickTarget",
280
- value: function onClickTarget(data) {
281
- d3.event.stopPropagation();
282
- d3.event.preventDefault();
283
- var onPeak = true;
284
- this.clickUiTargetAct(data, onPeak);
285
- }
286
- }, {
287
- key: "mergedPeaks",
288
- value: function mergedPeaks(editPeakSt) {
289
- if (!editPeakSt) return this.dataPks;
290
- this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
291
- return this.dataPks;
292
- }
293
- }, {
294
- key: "drawAUC",
295
- value: function drawAUC(stack) {
296
- var _this = this;
297
- var _TfRescale5 = (0, _compass.TfRescale)(this),
298
- xt = _TfRescale5.xt,
299
- yt = _TfRescale5.yt;
300
- var auc = this.tags.aucPath.selectAll('path').data(stack);
301
- auc.exit().attr('class', 'exit').remove();
302
- var integCurve = function integCurve(border) {
303
- var xL = border.xL,
304
- xU = border.xU;
305
- var ps = _this.data.filter(function (d) {
306
- return d.x > xL && d.x < xU;
307
- });
308
- if (!ps[0]) return null;
309
- var point1 = ps[0];
310
- var point2 = ps[ps.length - 1];
311
- var slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
312
- var lastDY = point1.y;
313
- return d3.area().x(function (d) {
314
- return xt(d.x);
315
- }).y0(function (d, index) {
316
- if (index > 0) {
317
- var lastD = ps[index - 1];
318
- var y = slope * (d.x - lastD.x) + lastDY;
319
- lastDY = y;
320
- return yt(y);
321
- }
322
- return yt(0);
323
- }).y1(function (d) {
324
- return yt(d.y);
325
- })(ps);
326
- };
327
- 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) {
328
- return integCurve(d);
329
- }).attr('id', function (d) {
330
- return "auc".concat((0, _focus.itgIdTag)(d));
331
- }).on('mouseover', function (d) {
332
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
333
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
334
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
335
- }).on('mouseout', function (d) {
336
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'none');
337
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill', 'red');
338
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill-opacity', 0.2);
339
- }).on('click', function (d) {
340
- return _this.onClickTarget(d);
341
- });
342
- }
343
- }, {
344
- key: "drawPeaks",
345
- value: function drawPeaks(editPeakSt) {
346
- var _this2 = this;
347
- var _this$shouldUpdate3 = this.shouldUpdate,
348
- sameXY = _this$shouldUpdate3.sameXY,
349
- sameEpSt = _this$shouldUpdate3.sameEpSt,
350
- sameDtPk = _this$shouldUpdate3.sameDtPk,
351
- sameSfPk = _this$shouldUpdate3.sameSfPk;
352
- if (!_format.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
353
-
354
- // rescale for zoom
355
- var _TfRescale6 = (0, _compass.TfRescale)(this),
356
- xt = _TfRescale6.xt,
357
- yt = _TfRescale6.yt;
358
- var dPks = this.mergedPeaks(editPeakSt);
359
- var mpp = this.tags.pPath.selectAll('path').data(dPks);
360
- mpp.exit().attr('class', 'exit').remove();
361
- var linePath = [{
362
- x: -0.5,
363
- y: 10
364
- }, {
365
- x: -0.5,
366
- y: -20
367
- }, {
368
- x: 0.5,
369
- y: -20
370
- }, {
371
- x: 0.5,
372
- y: 10
373
- }];
374
- // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
375
- var lineSymbol = d3.line().x(function (d) {
376
- return d.x;
377
- }).y(function (d) {
378
- return d.y;
379
- })(linePath);
380
- 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) {
381
- return "mpp".concat(Math.round(1000 * d.x));
382
- }).attr('transform', function (d) {
383
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y), ")");
384
- }).on('mouseover', function (d, i, n) {
385
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '1.0');
386
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'blue');
387
- var tipParams = {
388
- d: d,
389
- layout: _this2.layout
390
- };
391
- _this2.tip.show(tipParams, n[i]);
392
- }).on('mouseout', function (d, i, n) {
393
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '0.0');
394
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'red');
395
- var tipParams = {
396
- d: d,
397
- layout: _this2.layout
398
- };
399
- _this2.tip.hide(tipParams, n[i]);
400
- }).on('click', function (d) {
401
- return _this2.onClickTarget(d);
402
- });
403
- var ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
404
- if (ignoreRef) {
405
- var bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
406
- bpTxt.exit().attr('class', 'exit').remove();
407
- 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) {
408
- return "mpp".concat(Math.round(1000 * d.x));
409
- }).text(function (d) {
410
- return d.x.toFixed(2);
411
- }).attr('transform', function (d) {
412
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y) - 25, ")");
413
- }).on('click', function (d) {
414
- return _this2.onClickTarget(d);
415
- });
416
- }
417
- }
418
- }, {
419
- key: "drawInteg",
420
- value: function drawInteg(integationSt) {
421
- var _this3 = this;
422
- var _this$shouldUpdate4 = this.shouldUpdate,
423
- sameXY = _this$shouldUpdate4.sameXY,
424
- sameLySt = _this$shouldUpdate4.sameLySt,
425
- sameItSt = _this$shouldUpdate4.sameItSt,
426
- sameData = _this$shouldUpdate4.sameData;
427
- if (sameXY && sameLySt && sameItSt && sameData) return;
428
- var stack = integationSt.stack,
429
- refArea = integationSt.refArea,
430
- refFactor = integationSt.refFactor,
431
- shift = integationSt.shift;
432
- var isDisable = _cfg.default.btnCmdIntg(this.layout);
433
- var ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
434
- var itgs = isDisable ? [] : stack;
435
- var igbp = this.tags.igbPath.selectAll('path').data(itgs);
436
- igbp.exit().attr('class', 'exit').remove();
437
- var igcp = this.tags.igcPath.selectAll('path').data(itgs);
438
- igcp.exit().attr('class', 'exit').remove();
439
- var igtp = this.tags.igtPath.selectAll('text').data(itgs);
440
- igtp.exit().attr('class', 'exit').remove();
441
- if (itgs.length === 0 || isDisable) {
442
- // remove drawn area under curve
443
- var auc = this.tags.aucPath.selectAll('path').data(stack);
444
- auc.exit().attr('class', 'exit').remove();
445
- auc.merge(auc);
446
- return;
447
- }
448
- if (ignoreRef) {
449
- this.drawAUC(stack);
450
- } else {
451
- // rescale for zoom
452
- var _TfRescale7 = (0, _compass.TfRescale)(this),
453
- xt = _TfRescale7.xt;
454
- var dh = 50;
455
- var integBar = function integBar(data) {
456
- 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]]);
457
- };
458
- igbp.enter().append('path').attr('class', 'igbp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igbp).attr('id', function (d) {
459
- return "igbp".concat((0, _focus.itgIdTag)(d));
460
- }).attr('d', function (d) {
461
- return integBar(d);
462
- }).on('mouseover', function (d) {
463
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
464
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
465
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
466
- }).on('mouseout', function (d) {
467
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
468
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
469
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
470
- }).on('click', function (d) {
471
- return _this3.onClickTarget(d);
472
- });
473
- var integCurve = function integCurve(border) {
474
- var xL = border.xL,
475
- xU = border.xU;
476
- var nXL = xL - shift,
477
- nXU = xU - shift;
478
- var ps = _this3.data.filter(function (d) {
479
- return d.x > nXL && d.x < nXU;
480
- });
481
- var kMax = _this3.data[_this3.data.length - 1].k;
482
- if (!ps[0]) return null;
483
- var kRef = ps[0].k;
484
- if (!_this3.reverseXAxis(_this3.layout)) {
485
- return d3.line().x(function (d) {
486
- return xt(d.x);
487
- }).y(function (d) {
488
- return 100 - (kRef - d.k) * 400 / kMax;
489
- })(ps);
490
- }
491
- return d3.line().x(function (d) {
492
- return xt(d.x);
493
- }).y(function (d) {
494
- return 300 - (d.k - kRef) * 400 / kMax;
495
- })(ps);
496
- };
497
- igcp.enter().append('path').attr('class', 'igcp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igcp).attr('id', function (d) {
498
- return "igbc".concat((0, _focus.itgIdTag)(d));
499
- }).attr('d', function (d) {
500
- return integCurve(d);
501
- }).on('mouseover', function (d) {
502
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
503
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
504
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
505
- }).on('mouseout', function (d) {
506
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
507
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
508
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
509
- }).on('click', function (d) {
510
- return _this3.onClickTarget(d);
511
- });
512
- 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) {
513
- return "igtp".concat((0, _focus.itgIdTag)(d));
514
- }).text(function (d) {
515
- return (0, _integration.calcArea)(d, refArea, refFactor, ignoreRef);
516
- }).attr('transform', function (d) {
517
- return "translate(".concat(xt((d.xL + d.xU) / 2 - shift), ", ").concat(dh - 12, ")");
518
- }).on('mouseover', function (d) {
519
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
520
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
521
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
522
- }).on('mouseout', function (d) {
523
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
524
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
525
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
526
- }).on('click', function (d) {
527
- return _this3.onClickTarget(d);
528
- });
529
- }
530
- }
531
- }, {
532
- key: "drawMtply",
533
- value: function drawMtply(mtplySt) {
534
- var _ref2,
535
- _this4 = this;
536
- var _this$shouldUpdate5 = this.shouldUpdate,
537
- sameXY = _this$shouldUpdate5.sameXY,
538
- sameLySt = _this$shouldUpdate5.sameLySt,
539
- sameMySt = _this$shouldUpdate5.sameMySt;
540
- if (sameXY && sameLySt && sameMySt) return;
541
- var stack = mtplySt.stack,
542
- smExtext = mtplySt.smExtext,
543
- shift = mtplySt.shift;
544
- var mpys = stack;
545
- var isDisable = _cfg.default.btnCmdMpy(this.layout);
546
- if (mpys === 0 || isDisable) return;
547
- // rescale for zoom
548
- var _TfRescale8 = (0, _compass.TfRescale)(this),
549
- xt = _TfRescale8.xt;
550
- var mpyb = this.tags.mpybPath.selectAll('path').data(mpys);
551
- mpyb.exit().attr('class', 'exit').remove();
552
- var mpyt1 = this.tags.mpyt1Path.selectAll('text').data(mpys);
553
- mpyt1.exit().attr('class', 'exit').remove();
554
- var mpyt2 = this.tags.mpyt2Path.selectAll('text').data(mpys);
555
- mpyt2.exit().attr('class', 'exit').remove();
556
- var mPeaks = mpys.map(function (m) {
557
- var peaks = m.peaks,
558
- xExtent = m.xExtent;
559
- return peaks.map(function (p) {
560
- return Object.assign({}, p, {
561
- xExtent: xExtent
562
- });
563
- });
564
- });
565
- mPeaks = (_ref2 = []).concat.apply(_ref2, (0, _toConsumableArray2.default)(mPeaks));
566
- var mpyp = this.tags.mpypPath.selectAll('path').data(mPeaks);
567
- mpyp.exit().attr('class', 'exit').remove();
568
- var height = this.h;
569
- var dh = Math.abs(0.06 * height);
570
- var mpyBar = function mpyBar(data) {
571
- 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]]);
572
- };
573
- var mpyColor = function mpyColor(d) {
574
- var _d$xExtent = d.xExtent,
575
- xL = _d$xExtent.xL,
576
- xU = _d$xExtent.xU;
577
- return smExtext.xL === xL && smExtext.xU === xU ? 'purple' : '#DA70D6';
578
- };
579
- mpyb.enter().append('path').attr('class', 'mpyb').attr('fill', 'none').attr('stroke-width', 2).merge(mpyb).attr('stroke', function (d) {
580
- return mpyColor(d);
581
- }).attr('id', function (d) {
582
- return "mpyb".concat((0, _focus.mpyIdTag)(d));
583
- }).attr('d', function (d) {
584
- return mpyBar(d);
585
- }).on('mouseover', function (d) {
586
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
587
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
588
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
589
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
590
- }).on('mouseout', function (d) {
591
- var dColor = mpyColor(d);
592
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
593
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
594
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
595
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
596
- }).on('click', function (d) {
597
- return _this4.onClickTarget(d);
598
- });
599
- 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) {
600
- return mpyColor(d);
601
- }).attr('id', function (d) {
602
- return "mpyt1".concat((0, _focus.mpyIdTag)(d));
603
- }).text(function (d) {
604
- return "".concat((0, _multiplicity_calc.calcMpyCenter)(d.peaks, shift, d.mpyType).toFixed(3));
605
- }).attr('transform', function (d) {
606
- return "translate(".concat(xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift), ", ").concat(height - dh + 12, ")");
607
- }).on('mouseover', function (d) {
608
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
609
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
610
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
611
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
612
- }).on('mouseout', function (d) {
613
- var dColor = mpyColor(d);
614
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
615
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
616
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
617
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
618
- }).on('click', function (d) {
619
- return _this4.onClickTarget(d);
620
- });
621
- 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) {
622
- return mpyColor(d);
623
- }).attr('id', function (d) {
624
- return "mpyt2".concat((0, _focus.mpyIdTag)(d));
625
- }).text(function (d) {
626
- return "(".concat(d.mpyType, ")");
627
- }).attr('transform', function (d) {
628
- return "translate(".concat(xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift), ", ").concat(height - dh + 24, ")");
629
- }).on('mouseover', function (d) {
630
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
631
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
632
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
633
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
634
- }).on('mouseout', function (d) {
635
- var dColor = mpyColor(d);
636
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
637
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
638
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
639
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
640
- }).on('click', function (d) {
641
- return _this4.onClickTarget(d);
642
- });
643
- var mpypH = height - dh;
644
- var mpypPath = function mpypPath(pk) {
645
- return [{
646
- x: xt(pk.x - shift) - 0.5,
647
- y: mpypH - 5
648
- }, {
649
- x: xt(pk.x - shift) - 0.5,
650
- y: mpypH - 20
651
- }, {
652
- x: xt(pk.x - shift) + 0.5,
653
- y: mpypH - 20
654
- }, {
655
- x: xt(pk.x - shift) + 0.5,
656
- y: mpypH - 5
657
- }];
658
- };
659
- // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
660
- var lineSymbol = d3.line().x(function (d) {
661
- return d.x;
662
- }).y(function (d) {
663
- return d.y;
664
- });
665
- mpyp.enter().append('path').attr('class', 'mpyp').attr('fill', 'none').merge(mpyp).attr('stroke', function (d) {
666
- return mpyColor(d);
667
- }).attr('d', function (d) {
668
- return lineSymbol(mpypPath(d));
669
- }).attr('id', function (d) {
670
- return "mpyp".concat((0, _focus.mpyIdTag)(d));
671
- }).on('mouseover', function (d) {
672
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
673
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
674
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
675
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
676
- }).on('mouseout', function (d) {
677
- var dColor = mpyColor(d);
678
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
679
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
680
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
681
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
682
- }).on('click', function (d) {
683
- return _this4.onClickTarget(d);
684
- });
685
- }
686
- }, {
687
- key: "drawRef",
688
- value: function drawRef() {
689
- // rescale for zoom
690
- var _TfRescale9 = (0, _compass.TfRescale)(this),
691
- xt = _TfRescale9.xt,
692
- yt = _TfRescale9.yt;
693
- var ccp = this.ref.selectAll('path').data(this.tSfPeaks);
694
- ccp.exit().attr('class', 'exit').remove();
695
- var linePath = [{
696
- x: -0.5,
697
- y: 10
698
- }, {
699
- x: -4,
700
- y: -20
701
- }, {
702
- x: 4,
703
- y: -20
704
- }, {
705
- x: 0.5,
706
- y: 10
707
- }];
708
- var faktor = _format.default.isIrLayout(this.layout) ? -1 : 1;
709
- var lineSymbol = d3.line().x(function (d) {
710
- return d.x;
711
- }).y(function (d) {
712
- return faktor * d.y;
713
- })(linePath);
714
- 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) {
715
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y), ")");
716
- });
717
- }
718
- }, {
719
- key: "drawComparisons",
720
- value: function drawComparisons(comparisons) {
721
- var _this5 = this;
722
- d3.selectAll('.line-clip-compare').remove();
723
- if (!comparisons) return null;
724
- comparisons.forEach(function (c, idx) {
725
- if (!c.show) return;
726
- var path = (0, _mount.MountComparePath)(_this5, _format.default.compareColors(idx), idx); // #D5D8DC
727
- path.attr('d', _this5.pathCall(c.data));
728
- });
729
- return null;
730
- }
731
- }, {
732
- key: "reverseXAxis",
733
- value: function reverseXAxis(layoutSt) {
734
- 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, _list_layout.LIST_LAYOUT.CDS].indexOf(layoutSt) < 0;
735
- }
736
- }, {
737
- key: "create",
738
- value: function create(_ref3) {
739
- var filterSeed = _ref3.filterSeed,
740
- filterPeak = _ref3.filterPeak,
741
- tTrEndPts = _ref3.tTrEndPts,
742
- tSfPeaks = _ref3.tSfPeaks,
743
- freq = _ref3.freq,
744
- comparisons = _ref3.comparisons,
745
- editPeakSt = _ref3.editPeakSt,
746
- layoutSt = _ref3.layoutSt,
747
- integationSt = _ref3.integationSt,
748
- mtplySt = _ref3.mtplySt,
749
- sweepExtentSt = _ref3.sweepExtentSt,
750
- isUiAddIntgSt = _ref3.isUiAddIntgSt,
751
- isUiNoBrushSt = _ref3.isUiNoBrushSt,
752
- wavelength = _ref3.wavelength;
753
- this.svg = d3.select('.d3Svg');
754
- (0, _mount.MountMainFrame)(this, 'focus');
755
- (0, _mount.MountClip)(this);
756
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
757
- this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
758
- this.setTip();
759
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
760
- (0, _compass.MountCompass)(this);
761
- this.axis = (0, _mount.MountAxis)(this);
762
- this.path = (0, _mount.MountPath)(this, 'steelblue');
763
- var _MountThresLine = (0, _mount.MountThresLine)(this, 'green');
764
- var _MountThresLine2 = (0, _slicedToArray2.default)(_MountThresLine, 2);
765
- this.thresLineUp = _MountThresLine2[0];
766
- this.thresLineDw = _MountThresLine2[1];
767
- this.grid = (0, _mount.MountGrid)(this);
768
- this.tags = (0, _mount.MountTags)(this);
769
- this.ref = (0, _mount.MountRef)(this);
770
- (0, _mount.MountAxisLabelX)(this);
771
- (0, _mount.MountAxisLabelY)(this);
772
- if (this.data && this.data.length > 0) {
773
- this.setConfig(sweepExtentSt);
774
- this.drawLine();
775
- this.drawThres();
776
- this.drawGrid();
777
- this.drawRef();
778
- this.drawPeaks(editPeakSt);
779
- this.drawInteg(integationSt);
780
- this.drawMtply(mtplySt);
781
- this.drawComparisons(comparisons);
782
- }
783
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
784
- this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
785
- }
786
- }, {
787
- key: "update",
788
- value: function update(_ref4) {
789
- var filterSeed = _ref4.filterSeed,
790
- filterPeak = _ref4.filterPeak,
791
- tTrEndPts = _ref4.tTrEndPts,
792
- tSfPeaks = _ref4.tSfPeaks,
793
- freq = _ref4.freq,
794
- comparisons = _ref4.comparisons,
795
- editPeakSt = _ref4.editPeakSt,
796
- layoutSt = _ref4.layoutSt,
797
- integationSt = _ref4.integationSt,
798
- mtplySt = _ref4.mtplySt,
799
- sweepExtentSt = _ref4.sweepExtentSt,
800
- isUiAddIntgSt = _ref4.isUiAddIntgSt,
801
- isUiNoBrushSt = _ref4.isUiNoBrushSt,
802
- wavelength = _ref4.wavelength;
803
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
804
- this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
805
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
806
- if (this.data && this.data.length > 0) {
807
- this.setConfig(sweepExtentSt);
808
- this.getShouldUpdate(editPeakSt, integationSt, mtplySt);
809
- this.drawLine();
810
- this.drawThres();
811
- this.drawGrid();
812
- this.drawRef();
813
- this.drawPeaks(editPeakSt);
814
- this.drawInteg(integationSt);
815
- this.drawMtply(mtplySt);
816
- this.drawComparisons(comparisons);
817
- }
818
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
819
- this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
820
- }
821
- }]);
822
- return LineFocus;
823
- }();
824
- var _default = LineFocus;
825
- exports.default = _default;