Rede de Educação e Saúde
  • Proeficiência
  • Publicações
    • Publicações Gerais
    • Artigos
  • Cursos de Formação
    • Curso de especialização
    • Jovem Doutor
  • Sobre
function fixNumber(number, decimal){
  if (isNaN(number)){
    return "-";
  }

  return number.toFixed(decimal)
}


function clearChartGroup(chartGroup, chartID, chartWidth, chartHeight){
  try {
    document.getElementById(chartGroup).replaceChildren();
    const para = document.createElement("canvas");
    para.setAttribute("id", chartID);
    para.setAttribute("width", chartWidth);
    para.setAttribute("height", chartHeight);

    document.getElementById(chartGroup).appendChild(para);
  } catch (error) {
    throw console.error();
  }
  
}


function changeVisible(element, value){
    if(value){
      if (document.getElementById(element).classList.contains("d-none")){
        document.getElementById(element).classList.remove("d-none");  
      }
    }else{
      if (!document.getElementById(element).classList.contains("d-none")){
        document.getElementById(element).classList.add("d-none");    
      } 
    } 
}


function getOrdemAnual(list, id){
  var index = list.findIndex(function(item) {
    return item.id == id;
  }) + 1;

  return index;
}



function getPositionColor(position){
  if (isNaN(position)){
    return "grey";
  }

  if(Number(position) < 21){
    return "darkgreen";
  }
  else if(Number(position) < 251){
    return "darkorange";
  }
  else{
    return "darkred";
  }
}

Informações de fácil acesso.

Até mesmo offline.

viewof textInput = html`<input type="search" class="form-control inputSearchRight" id="searchCity" placeholder="Digite o Município" name="q">`

  data = FileAttachment("files/Matriculas 2010 a 2022 ID.xlsx").xlsx();

  searchCityFilter = data.sheet("id").filter(function(element) { 

    if (textInput.trim() === ""){
      return false;
    }

    var normalizedElementA = element.A.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
    var normalizedTextInput = textInput.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();

    return normalizedElementA.startsWith(normalizedTextInput);
  })

  
  hideSearch =  {
    if(textInput == "" || searchCityFilter.length == 0){
      changeVisible("searchTab", false);
      return;
    }
  }
  
  showSearch =  {
    if (searchCityFilter.length > 0){
      changeVisible("searchTab", true);
      return;
    }
  }
updateSearch = function () {
    document.getElementById("searchListGroup").replaceChildren();

    for (let i = 0; i < 5; i++) {
      const element = searchCityFilter[i];
      if(element){
        const para = document.createElement("a");
        para.setAttribute("href", location+"municipio.html?id=" + element.B);
        para.classList.add("list-group-item");
        para.classList.add("list-group-item-action");

        const node = document.createTextNode(element.A);
        para.appendChild(node);

        document.getElementById("searchListGroup").appendChild(para);
      }
    }
    
  }

  updateSearch();
json = FileAttachment("files/geojs_bahia.json").json()

html`<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>`
html`<div id="map" style="height: 600px;"></div>`
viewof map = {
  const mapDiv = document.getElementById('map');
  
  const map = L.map(mapDiv).setView([-12.9714, -38.5014], 10);

  L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
    subdomains: 'abcd',
    maxZoom: 20
  }).addTo(map);

  
  L.geoJSON(json, {
    style: {
    color: 'green', 
    weight: 1 
  }, 
      onEachFeature: function (feature, layer) {
    const popupContent = `
      <button onclick="window.location.href = '${location}municipio.html?id=' + ${feature.properties.id};">Visualizar dados de ${feature.properties.name}</button>
    `;

    layer.bindPopup(popupContent);
  }
  }).addTo(map);


  return mapDiv;
}
  • Página inicial

  • Sobre

  • Versão: p0.1
  • Realização: