static/js/display.js
/**
 * Update table in discrete color legend.
 * @function updateColorTable
 * @param {Object} mo - main object
 */
Update table in discrete color legend.
@function updateColorTable
@param {Object} mo - main object
Update table in discrete color legend . @function updateColorTable @param { Object } mo - main object
function updateColorTable(mo) {
  const table = byId('color-table');
  table.innerHTML = '';
  const cmap = mo.view.color.discmap;
  let row, cell, div;
  for (let cat in cmap) {
    row = table.insertRow(-1);
    cell = row.insertCell(-1);
    div = document.createElement('div');
    div.innerHTML = '&nbsp;';
    div.style.backgroundColor = '#' + cmap[cat];
    cell.appendChild(div);
    cell = row.insertCell(-1);
    cell.innerHTML = cat;
  }
  row = table.insertRow(-1);
  cell = row.insertCell(-1);
  div = document.createElement('div');
  div.innerHTML = '&nbsp;';
  div.style.backgroundColor = 'black';
  cell.appendChild(div);
  cell = row.insertCell(-1);
  cell.innerHTML = 'Others & N/A';
}
function updateColorTable ( mo ) { const table = byId ( 'color-table' ) ; table . innerHTML = '' ; const cmap = mo . view . color . discmap ; let row , cell , div ; for ( let cat in cmap ) { row = table . insertRow ( - 1 ) ; cell = row . insertCell ( - 1 ) ; div = document . createElement ( 'div' ) ; div . innerHTML = '&nbsp;' ; div . style . backgroundColor = '#' + cmap [ cat ] ; cell . appendChild ( div ) ; cell = row . insertCell ( - 1 ) ; cell . innerHTML = cat ; } row = table . insertRow ( - 1 ) ; cell = row . insertCell ( - 1 ) ; div = document . createElement ( 'div' ) ; div . innerHTML = '&nbsp;' ; div . style . backgroundColor = 'black' ; cell . appendChild ( div ) ; cell = row . insertCell ( - 1 ) ; cell . innerHTML = 'Others & N/A' ; }
Update table in discrete color legend.
Update table in discrete color legend .
// row for each category // row for others & n/a