static/js/display.js
/**
 * Reset workspace when dataset is open or closed.
 * @function resetWorkspace
 * @param {Object} mo - main object
 * @description Singling out cache is for performance consideration.
 */
Reset workspace when dataset is open or closed.
@function resetWorkspace
@param {Object} mo - main object
@description Singling out cache is for performance consideration.
Reset workspace when dataset is open or closed . @function resetWorkspace @param { Object } mo - main object @description Singling out cache is for performance consideration .
function resetWorkspace(mo) {
  resetControls();
  const data = mo.data,
        cache = mo.cache;
  if (data.length === 0) cache.nctg = 0;
  else cache.nctg = data[0].length;
  const n = cache.nctg;
  mo.picked = Array(n).fill(false);
  mo.masked = Array(n).fill(false);
  mo.blured = Array(n).fill(false);
  mo.highed = Array(n).fill(0);
  mo.binned = Array(n).fill('');
  mo.tabled = n ? [...data[0].keys()] : [];
  byId('bin-tbody').innerHTML = '';
  const trans = mo.trans;
  for (let item of ['x', 'y', 'size', 'opacity', 'color', 'rgb', 'rgba']) {
    trans[item] = Array(n);
  }
  cache.abund = 0;
  cache.freqs = {};
  cache.npick = 0;
  cache.nmask = 0;
  cache.maskh = [];
  cache.binns.clear();
  cache.pdist = [];
  if (n) {
    resetGUINewData(mo);
    cacheFrequencies(mo);
    cacheTotAbundance(mo);
  }
  else {
    resetGUINoData(mo);
    cache.splen = 0;
    cache.spcov = 0;
  }
  initDisplayItems(mo);
  updateWorkspace(mo);
  resetView(mo);
}
function resetWorkspace ( mo ) { resetControls ( ) ; const data = mo . data , cache = mo . cache ; if ( data . length === 0 ) cache . nctg = 0 ; else cache . nctg = data [ 0 ] . length ; const n = cache . nctg ; mo . picked = Array ( n ) . fill ( false ) ; mo . masked = Array ( n ) . fill ( false ) ; mo . blured = Array ( n ) . fill ( false ) ; mo . highed = Array ( n ) . fill ( 0 ) ; mo . binned = Array ( n ) . fill ( '' ) ; mo . tabled = n ? [ ... data [ 0 ] . keys ( ) ] : [ ] ; byId ( 'bin-tbody' ) . innerHTML = '' ; const trans = mo . trans ; for ( let item of [ 'x' , 'y' , 'size' , 'opacity' , 'color' , 'rgb' , 'rgba' ] ) { trans [ item ] = Array ( n ) ; } cache . abund = 0 ; cache . freqs = { } ; cache . npick = 0 ; cache . nmask = 0 ; cache . maskh = [ ] ; cache . binns . clear ( ) ; cache . pdist = [ ] ; if ( n ) { resetGUINewData ( mo ) ; cacheFrequencies ( mo ) ; cacheTotAbundance ( mo ) ; } else { resetGUINoData ( mo ) ; cache . splen = 0 ; cache . spcov = 0 ; } initDisplayItems ( mo ) ; updateWorkspace ( mo ) ; resetView ( mo ) ; }
Reset workspace when dataset is open or closed.
Reset workspace when dataset is open or closed .
// check whether there is data // reset working progress // reset binning plan // reset transformed data // clear cache // new data is open // no data is open // reset display items // reset view