@@ -36,7 +36,9 @@ import PeakGroup from '../cmd_bar/08_peak_group';
3636import Threshold from '../cmd_bar/r03_threshold' ;
3737import Integration from '../cmd_bar/04_integration' ;
3838import Peak from '../cmd_bar/03_peak' ;
39- import { getLcMsInfo } from '../../helpers/extractEntityLCMS' ;
39+ import {
40+ getLcMsInfo , getLcMsXUnit , formatLcmsTimeXLabel ,
41+ } from '../../helpers/extractEntityLCMS' ;
4042
4143const W = Math . round ( window . innerWidth * 0.90 * 9 / 12 ) ; // ROI
4244const H = Math . round ( window . innerHeight * 0.90 * 0.8 / 3 ) ; // ROI
@@ -259,7 +261,7 @@ class ViewerLineRect extends React.Component {
259261
260262 componentDidMount ( ) {
261263 const {
262- curveSt, feature, ticEntities, hplcMsSt,
264+ curveSt, feature, ticEntities, uvvisEntities , hplcMsSt,
263265 tTrEndPts, layoutSt,
264266 isUiAddIntgSt, isUiNoBrushSt,
265267 integrationSt,
@@ -282,6 +284,8 @@ class ViewerLineRect extends React.Component {
282284 const { x, y } = currentData ;
283285 uvvisSeed = toSeed ( x , y ) ;
284286 }
287+ const rawXUnit = getLcMsXUnit ( uvvisEntities ?. [ 0 ] ) || getLcMsXUnit ( ticEntities ?. [ 0 ] ) ;
288+ const timeXLabel = formatLcmsTimeXLabel ( rawXUnit ) ;
285289 drawMain ( this . rootKlassLine , W , H , LIST_BRUSH_SVG_GRAPH . LINE ) ;
286290 this . lineFocus . create ( {
287291 filterSeed : uvvisSeed ,
@@ -294,8 +298,9 @@ class ViewerLineRect extends React.Component {
294298 isUiAddIntgSt,
295299 editPeakSt,
296300 hplcMsSt,
301+ uvvisXUnit : rawXUnit ,
297302 } ) ;
298- drawLabel ( this . rootKlassLine , null , 'Minutes' , 'Intensity' ) ;
303+ drawLabel ( this . rootKlassLine , null , timeXLabel , 'Intensity' ) ;
299304 drawDisplay ( this . rootKlassLine , false ) ;
300305
301306 drawMain ( this . rootKlassMulti , W , H , LIST_BRUSH_SVG_GRAPH . MULTI ) ;
@@ -309,7 +314,7 @@ class ViewerLineRect extends React.Component {
309314 isUiAddIntgSt,
310315 isUiNoBrushSt,
311316 } ) ;
312- drawLabel ( this . rootKlassMulti , null , 'Minutes' , 'Intensity' ) ;
317+ drawLabel ( this . rootKlassMulti , null , timeXLabel , 'Intensity' ) ;
313318 drawDisplay ( this . rootKlassMulti , isHidden ) ;
314319
315320 drawMain ( this . rootKlassRect , W , H , LIST_BRUSH_SVG_GRAPH . RECT ) ;
@@ -327,7 +332,7 @@ class ViewerLineRect extends React.Component {
327332
328333 componentDidUpdate ( prevProps ) {
329334 const {
330- ticEntities, curveSt,
335+ ticEntities, uvvisEntities , curveSt,
331336 tTrEndPts, layoutSt,
332337 isUiAddIntgSt, isUiNoBrushSt,
333338 isHidden, uiSt, hplcMsSt, integrationSt,
@@ -350,6 +355,7 @@ class ViewerLineRect extends React.Component {
350355 const currentData = data [ 0 ] ;
351356 const { x, y } = currentData ;
352357 const uvvisSeed = toSeed ( x , y ) ;
358+ const uvvisXUnit = getLcMsXUnit ( uvvisEntities ?. [ 0 ] ) || getLcMsXUnit ( ticEntities ?. [ 0 ] ) ;
353359 if ( this . lineFocus ) {
354360 this . lineFocus . update ( {
355361 filterSeed : uvvisSeed ,
@@ -363,9 +369,13 @@ class ViewerLineRect extends React.Component {
363369 integrationSt,
364370 hplcMsSt,
365371 editPeakSt,
372+ uvvisXUnit,
366373 } ) ;
367374 }
368- drawLabel ( this . rootKlassLine , null , 'Minutes' , 'Intensity' ) ;
375+ const timeXLabelLine = formatLcmsTimeXLabel (
376+ getLcMsXUnit ( uvvisEntities ?. [ 0 ] ) || getLcMsXUnit ( ticEntities ?. [ 0 ] ) ,
377+ ) ;
378+ drawLabel ( this . rootKlassLine , null , timeXLabelLine , 'Intensity' ) ;
369379 drawDisplay ( this . rootKlassLine , false ) ;
370380 }
371381
@@ -396,7 +406,10 @@ class ViewerLineRect extends React.Component {
396406 } else if ( polarity === 'positive' ) {
397407 ticLabel = 'PLUS' ;
398408 }
399- drawLabel ( this . rootKlassMulti , ticLabel , 'Minutes' , 'Intensity' ) ;
409+ const timeXLabelMulti = formatLcmsTimeXLabel (
410+ getLcMsXUnit ( uvvisEntities ?. [ 0 ] ) || getLcMsXUnit ( ticEntities ?. [ 0 ] ) ,
411+ ) ;
412+ drawLabel ( this . rootKlassMulti , ticLabel , timeXLabelMulti , 'Intensity' ) ;
400413 drawDisplay ( this . rootKlassMulti , isHidden ) ;
401414
402415 const subViewFeature = this . extractSubView ( ) ;
@@ -428,9 +441,13 @@ class ViewerLineRect extends React.Component {
428441 uiSt,
429442 } ) ;
430443 }
444+ const timeXLabelRect = formatLcmsTimeXLabel (
445+ getLcMsXUnit ( uvvisEntities ?. [ 0 ] ) || getLcMsXUnit ( ticEntities ?. [ 0 ] ) ,
446+ ) ;
447+ const timeSuffix = timeXLabelRect === 'Seconds' ? ' s' : ' min' ;
431448 drawLabel (
432449 this . rootKlassRect ,
433- labelValue != null ? `${ labelValue } min ` : null ,
450+ labelValue != null ? `${ labelValue } ${ timeSuffix } ` : null ,
434451 'm/z' ,
435452 'Intensity' ,
436453 ) ;
0 commit comments