function buildColorLegend() {
  let table = document.getElementById("colors-legend-table");
  for (let i = 0; i < COLOR_MAPPING.length; i++) {
    let color = COLOR_MAPPING[i][1];
    let name = COLOR_MAPPING[i][2];
    let row = document.createElement("tr");
    row.setAttribute("align", "left");
    let colorRectangle = document.createElement("td");
    colorRectangle.setAttribute("class", "legend-rectangle");
    colorRectangle.setAttribute("style", `background-color: ${color}`);
    let label = document.createElement("td");
    label.innerHTML = name;
    row.appendChild(colorRectangle);
    row.appendChild(label);
    table.appendChild(row);
  }
}
/**
 * Adds the color legend to the document.
 */
Adds the color legend to the document.
Adds the color legend to the document .
function buildColorLegend() {
  let table = document.getElementById("colors-legend-table");
  for (let i = 0; i < COLOR_MAPPING.length; i++) {
    let color = COLOR_MAPPING[i][1];
    let name = COLOR_MAPPING[i][2];
    let row = document.createElement("tr");
    row.setAttribute("align", "left");
    let colorRectangle = document.createElement("td");
    colorRectangle.setAttribute("class", "legend-rectangle");
    colorRectangle.setAttribute("style", `background-color: ${color}`);
    let label = document.createElement("td");
    label.innerHTML = name;
    row.appendChild(colorRectangle);
    row.appendChild(label);
    table.appendChild(row);
  }
}
function buildColorLegend ( ) { let table = document . getElementById ( "colors-legend-table" ) ; for ( let i = 0 ; i < COLOR_MAPPING . length ; i ++ ) { let color = COLOR_MAPPING [ i ] [ 1 ] ; let name = COLOR_MAPPING [ i ] [ 2 ] ; let row = document . createElement ( "tr" ) ; row . setAttribute ( "align" , "left" ) ; let colorRectangle = document . createElement ( "td" ) ; colorRectangle . setAttribute ( "class" , "legend-rectangle" ) ; colorRectangle . setAttribute ( "style" , ` ${ color } ` ) ; let label = document . createElement ( "td" ) ; label . innerHTML = name ; row . appendChild ( colorRectangle ) ; row . appendChild ( label ) ; table . appendChild ( row ) ; } }
Adds the color legend to the document.
Adds the color legend to the document .