Skip to content

Commit

Permalink
fix: fixed shift referent for multi spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan Le committed Aug 19, 2024
1 parent 1a6a24d commit 90ad267
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
15 changes: 9 additions & 6 deletions dist/components/d3_multi/multi_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var _integration = require("../../helpers/integration");
var _multiplicity_calc = require("../../helpers/multiplicity_calc");
var _calc = require("../../helpers/calc");
/* eslint-disable no-unused-vars, prefer-object-spread, no-mixed-operators,
no-unneeded-ternary, arrow-body-style */
no-unneeded-ternary, arrow-body-style, max-len */

const d3 = require('d3');
class MultiFocus {
Expand Down Expand Up @@ -158,8 +158,8 @@ class MultiFocus {
this.tip = (0, _init.InitTip)();
this.root.call(this.tip);
}
setDataParams(peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
let jcampIdx = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
setDataParams(filterSeed, peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
let jcampIdx = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
this.data = [];
this.otherLineData = [];
let filterSubLayoutValue = null;
Expand All @@ -170,8 +170,11 @@ class MultiFocus {
color
} = entry;
const offset = (0, _chem.GetCyclicVoltaPreviousShift)(cyclicvoltaSt, jcampIdx);
const currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
let currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
if (idx === jcampIdx) {
if (!_format.default.isCyclicVoltaLayout(layout)) {
currData = filterSeed;
}
this.data = [...currData];
this.pathColor = color;
filterSubLayoutValue = _format.default.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
Expand Down Expand Up @@ -835,7 +838,7 @@ class MultiFocus {
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
this.setTip();
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
(0, _compass.MountCompass)(this);
this.axis = (0, _mount.MountAxis)(this);
this.path = (0, _mount.MountPath)(this, this.pathColor);
Expand Down Expand Up @@ -885,7 +888,7 @@ class MultiFocus {
const jcampIdx = curveIdx;
this.isShowAllCurves = isShowAllCurve;
this.entities = entities;
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
if (this.data && this.data.length > 0) {
this.setConfig(sweepExtentSt);
this.getShouldUpdate(editPeakSt);
Expand Down
13 changes: 8 additions & 5 deletions src/components/d3_multi/multi_focus.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-unused-vars, prefer-object-spread, no-mixed-operators,
no-unneeded-ternary, arrow-body-style */
no-unneeded-ternary, arrow-body-style, max-len */
import {
InitScale, InitAxisCall, InitTip,
} from '../../helpers/init';
Expand Down Expand Up @@ -145,15 +145,18 @@ class MultiFocus {
this.root.call(this.tip);
}

setDataParams(peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt, jcampIdx = 0) {
setDataParams(filterSeed, peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt, jcampIdx = 0) {
this.data = [];
this.otherLineData = [];
let filterSubLayoutValue = null;
this.entities.forEach((entry, idx) => {
const { topic, feature, color } = entry;
const offset = GetCyclicVoltaPreviousShift(cyclicvoltaSt, jcampIdx);
const currData = convertTopic(topic, layout, feature, offset);
let currData = convertTopic(topic, layout, feature, offset);
if (idx === jcampIdx) {
if (!Format.isCyclicVoltaLayout(layout)) {
currData = filterSeed;
}
this.data = [...currData];
this.pathColor = color;
filterSubLayoutValue = Format.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
Expand Down Expand Up @@ -1023,7 +1026,7 @@ class MultiFocus {
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
this.scales = InitScale(this, this.reverseXAxis(layoutSt));
this.setTip();
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
MountCompass(this);

this.axis = MountAxis(this);
Expand Down Expand Up @@ -1066,7 +1069,7 @@ class MultiFocus {
this.isShowAllCurves = isShowAllCurve;
this.entities = entities;

this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);

if (this.data && this.data.length > 0) {
this.setConfig(sweepExtentSt);
Expand Down

0 comments on commit 90ad267

Please sign in to comment.