File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
histomicsui/web_client/panels Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,31 @@ var MetadataPlot = Panel.extend({
357357 parts . push ( plotData . series [ series ] ) ;
358358 }
359359 } ) ;
360- parts = parts . map ( ( col ) => `${ col . title } : ${ col . type === 'number' ? this . _formatNumber ( d [ col . index ] ) : d [ col . index ] } ` ) ;
360+ const maximized = this . $el . closest ( '.h-panel-maximized' ) . length > 0 ;
361+ const maxtotallen = 50 ;
362+ const maxlen = 32 ;
363+ parts = parts . map ( ( col ) => {
364+ let title = '' + col . title ;
365+ let val = d [ col . index ] ;
366+ if ( val === undefined || val === null ) {
367+ val = '' ;
368+ } else if ( col . type === 'number' ) {
369+ val = this . _formatNumber ( val ) ;
370+ } else {
371+ val = '' + val ;
372+ }
373+ const result = title + ': ' + val ;
374+ if ( maximized || result . length <= maxtotallen ) {
375+ return result ;
376+ }
377+ if ( val . length > maxlen + 3 ) {
378+ val = val . substring ( 0 , maxlen ) . replace ( / \. + $ / , '' ) + '...' ;
379+ }
380+ if ( title . length + val . length + 2 > maxtotallen + 3 ) {
381+ title = title . substring ( 0 , maxtotallen - val . length - 2 ) . replace ( / \. + $ / , '' ) + '...' ;
382+ }
383+ return title + ': ' + val ;
384+ } ) ;
361385
362386 const imageDict = {
363387 id : 'item.id' ,
You can’t perform that action at this time.
0 commit comments