Skip to content

Commit 9077f4a

Browse files
committed
fix: apply WE-ESCA yFactor to tooltip values and push dist
1 parent 5f9aa7c commit 9077f4a

6 files changed

Lines changed: 21 additions & 19 deletions

File tree

‎dist/components/d3_multi/index.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ class ViewerMulti extends _react.default.Component {
135135
cyclicvoltaSt,
136136
integationSt,
137137
mtplySt,
138-
axesUnitsSt,
139-
feature
138+
axesUnitsSt
140139
} = this.props;
141140
this.normChange(prevProps);
142141
let xxLabel = xLabel;

‎dist/components/d3_multi/multi_focus.js‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,17 @@ class MultiFocus {
511511
d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'blue');
512512
const tipParams = {
513513
d,
514-
layout: this.layout
514+
layout: this.layout,
515+
yFactor: this.yTransformFactor
515516
};
516517
this.tip.show(tipParams, event.target);
517518
}).on('mouseout', (event, d) => {
518519
d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '0.0');
519520
d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'red');
520521
const tipParams = {
521522
d,
522-
layout: this.layout
523+
layout: this.layout,
524+
yFactor: this.yTransformFactor
523525
};
524526
this.tip.hide(tipParams, event.target);
525527
}).on('click', (event, d) => this.onClickTarget(event, d));
@@ -572,15 +574,17 @@ class MultiFocus {
572574
d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'blue');
573575
const tipParams = {
574576
d,
575-
layout: this.layout
577+
layout: this.layout,
578+
yFactor: this.yTransformFactor
576579
};
577580
this.tip.show(tipParams, event.target);
578581
}).on('mouseout', (event, d) => {
579582
d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '0.0');
580583
d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', '#228B22');
581584
const tipParams = {
582585
d,
583-
layout: this.layout
586+
layout: this.layout,
587+
yFactor: this.yTransformFactor
584588
};
585589
this.tip.hide(tipParams, event.target);
586590
}).on('click', (event, d) => this.onClickPecker(event, d));

‎dist/components/panel/cyclic_voltamery_data.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ const CyclicVoltammetryPanel = ({
118118
const formatCurrent = (y, feature, cyclicVotaSt) => {
119119
const baseY = feature && feature.yUnit ? String(feature.yUnit) : 'A';
120120
const isMilli = /mA/i.test(baseY);
121-
console.log('isMilli', isMilli);
122121
const useDensity = cyclicVotaSt && cyclicVotaSt.useCurrentDensity;
123122
const rawArea = (cyclicVotaSt && cyclicVotaSt.areaValue === '' ? 1.0 : cyclicVotaSt?.areaValue) || 1.0;
124123
const areaUnit = cyclicVotaSt && cyclicVotaSt.areaUnit ? cyclicVotaSt.areaUnit : 'cm²';
@@ -131,7 +130,6 @@ const CyclicVoltammetryPanel = ({
131130
}
132131
if (isMilli) {
133132
val *= 1000.0;
134-
console.log('val', val);
135133
}
136134
return `${parseFloat(val).toExponential(2)} ${unit}`;
137135
};

‎dist/helpers/init.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,23 @@ const tpStyle = () => {
4545
const style = stBorder + stBorderRadius + stBackground + stColor + stPadding + stOpacity + stPadding + stZindex + stFontFamily;
4646
return style;
4747
};
48-
const tpDiv = (d, digits) => `
48+
const tpDiv = (d, digits, yFactor = 1) => `
4949
<div
5050
class="peak-tp"
5151
style="${tpStyle()}"
5252
>
5353
<span> x: ${_format.default.fixDigit(d.x, digits)}</span>
5454
<br/>
55-
<span> y: ${d3.format('.2~e')(d.y)}</span>
55+
<span> y: ${d3.format('.2~e')(d.y * (yFactor || 1))}</span>
5656
<div>
5757
`;
5858
const InitTip = () => {
5959
d3.select('.peak-tp').remove();
6060
const tip = (0, _d3Tip.default)().attr('class', 'd3-tip').html(({
6161
d,
62-
layout
63-
}) => tpDiv(d, _format.default.spectraDigit(layout)));
62+
layout,
63+
yFactor
64+
}) => tpDiv(d, _format.default.spectraDigit(layout), yFactor || 1));
6465
return tip;
6566
};
6667
exports.InitTip = InitTip;

‎src/components/d3_multi/multi_focus.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,15 @@ class MultiFocus {
503503
.attr('stroke-opacity', '1.0');
504504
d3.select(`#bpt${Math.round(1000 * d.x)}`)
505505
.style('fill', 'blue');
506-
const tipParams = { d, layout: this.layout };
506+
const tipParams = { d, layout: this.layout, yFactor: this.yTransformFactor };
507507
this.tip.show(tipParams, event.target);
508508
})
509509
.on('mouseout', (event, d) => {
510510
d3.select(`#mpp${Math.round(1000 * d.x)}`)
511511
.attr('stroke-opacity', '0.0');
512512
d3.select(`#bpt${Math.round(1000 * d.x)}`)
513513
.style('fill', 'red');
514-
const tipParams = { d, layout: this.layout };
514+
const tipParams = { d, layout: this.layout, yFactor: this.yTransformFactor };
515515
this.tip.hide(tipParams, event.target);
516516
})
517517
.on('click', (event, d) => this.onClickTarget(event, d));
@@ -589,15 +589,15 @@ class MultiFocus {
589589
.attr('stroke-opacity', '1.0');
590590
d3.select(`#bpt${Math.round(1000 * d.x)}`)
591591
.style('fill', 'blue');
592-
const tipParams = { d, layout: this.layout };
592+
const tipParams = { d, layout: this.layout, yFactor: this.yTransformFactor };
593593
this.tip.show(tipParams, event.target);
594594
})
595595
.on('mouseout', (event, d) => {
596596
d3.select(`#mpp${Math.round(1000 * d.x)}`)
597597
.attr('stroke-opacity', '0.0');
598598
d3.select(`#bpt${Math.round(1000 * d.x)}`)
599599
.style('fill', '#228B22');
600-
const tipParams = { d, layout: this.layout };
600+
const tipParams = { d, layout: this.layout, yFactor: this.yTransformFactor };
601601
this.tip.hide(tipParams, event.target);
602602
})
603603
.on('click', (event, d) => this.onClickPecker(event, d));

‎src/helpers/init.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ const tpStyle = () => {
4444
return style;
4545
};
4646

47-
const tpDiv = (d, digits) => (
47+
const tpDiv = (d, digits, yFactor = 1) => (
4848
`
4949
<div
5050
class="peak-tp"
5151
style="${tpStyle()}"
5252
>
5353
<span> x: ${FN.fixDigit(d.x, digits)}</span>
5454
<br/>
55-
<span> y: ${d3.format('.2~e')(d.y)}</span>
55+
<span> y: ${d3.format('.2~e')(d.y * (yFactor || 1))}</span>
5656
<div>
5757
`
5858
);
@@ -61,7 +61,7 @@ const InitTip = () => {
6161
d3.select('.peak-tp').remove();
6262
const tip = d3Tip()
6363
.attr('class', 'd3-tip')
64-
.html(({ d, layout }) => tpDiv(d, FN.spectraDigit(layout)));
64+
.html(({ d, layout, yFactor }) => tpDiv(d, FN.spectraDigit(layout), yFactor || 1));
6565
return tip;
6666
};
6767

0 commit comments

Comments
 (0)