static/js/calculate.js
/**
 * Update calculation controls.
 * @function updateCalcBoxCtrl
 * @param {Object} mo - main object
 */
Update calculation controls.
@function updateCalcBoxCtrl
@param {Object} mo - main object
Update calculation controls . @function updateCalcBoxCtrl @param { Object } mo - main object
function updateCalcBoxCtrl(mo) {
  byId('silh-table-wrap').classList.add('hidden');
  byId('silh-calc-btn').classList.remove('hidden');
  byId('silh-title').classList.remove('hidden');
  byId('silh-progress').classList.add('hidden');
  byId('silh-done-div').classList.add('hidden');
  byId('silh-done-btn').classList.add('hidden');
  const view = mo.view,
        cols = mo.cols;
  let v, idx, chk, scale, n = 0;
  for (let item of ['x', 'y', 'size', 'opacity', 'color']) {
    v = view[item];
    idx = v.i;
    if (idx && cols.types[idx] === 'num') {
      chk = byId(`${item}-calc-chk`);
      chk.disabled = false;
      scale = v.scale;
      if (chk.checked) n++;
      byId(`${item}-calc-var`).textContent = cols.names[idx] + (
        (scale !== 'none') ? ` (${scale})` : '');
    } else {
      byId(`${item}-calc-chk`).disabled = true;
      byId(`${item}-calc-var`).textContent = '';
    }
  }
  byId('silh-calc-btn').disabled = (n === 0);
  byId('silh-col-text').value = 'silhouette';
}
function updateCalcBoxCtrl ( mo ) { byId ( 'silh-table-wrap' ) . classList . add ( 'hidden' ) ; byId ( 'silh-calc-btn' ) . classList . remove ( 'hidden' ) ; byId ( 'silh-title' ) . classList . remove ( 'hidden' ) ; byId ( 'silh-progress' ) . classList . add ( 'hidden' ) ; byId ( 'silh-done-div' ) . classList . add ( 'hidden' ) ; byId ( 'silh-done-btn' ) . classList . add ( 'hidden' ) ; const view = mo . view , cols = mo . cols ; let v , idx , chk , scale , n = 0 ; for ( let item of [ 'x' , 'y' , 'size' , 'opacity' , 'color' ] ) { v = view [ item ] ; idx = v . i ; if ( idx && cols . types [ idx ] === 'num' ) { chk = byId ( ` ${ item } ` ) ; chk . disabled = false ; scale = v . scale ; if ( chk . checked ) n ++ ; byId ( ` ${ item } ` ) . textContent = cols . names [ idx ] + ( ( scale !== 'none' ) ? ` ${ scale } ` : '' ) ; } else { byId ( ` ${ item } ` ) . disabled = true ; byId ( ` ${ item } ` ) . textContent = '' ; } } byId ( 'silh-calc-btn' ) . disabled = ( n === 0 ) ; byId ( 'silh-col-text' ) . value = 'silhouette' ; }
Update calculation controls.
Update calculation controls .
// available variables