Published
Edited
Apr 28, 2021
Insert cell
Insert cell
Insert cell
//ESTA CELDA SE DEBE CORRER CADA VEZ QUE SE CAMBIA EL DEPARTAMENTO
chosenDepto = {
for(var i = 0; i < depto.length; i++){
if(depto[i].key == departamento.value){
return depto[i].values;
}
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
depto[1].values
Insert cell
Insert cell
Insert cell
md`# Intento de hacerlo por ciudades de cada departamento y por cada colegio`
Insert cell
Insert cell
Insert cell
citiesInDepto = {
function filtrar(arr){
for(var i = 0; i < depto.length; i++){
if(arr[i].key == departamento.value){
return arr[i].values;
}
}
}
return d3.nest()
.key(function(d) { return d["cole_mcpio_ubicacion"]; })
.entries(filtrar(depto));
}
Insert cell
{
const seleccion = d3.select(ciudad);

const addOption = (d, i) =>
seleccion.append("option")
.text(d.key);

citiesInDepto.forEach(addOption);
return seleccion.node();
}
Insert cell
schoolsInCity = {
function filtrar(arr){
for(var i = 0; i < citiesInDepto.length; i++){
if(arr[i].key == ciudad.value){
return arr[i].values;
}
}
}
return d3.nest()
.key(function(d) { return d["cole_nombre_establecimiento"]; })
.entries(filtrar(citiesInDepto));
}
Insert cell
{
const seleccion = d3.select(colegio);

const addOption = (d, i) =>
seleccion.append("option")
.text(d.key);

schoolsInCity.forEach(addOption);
return seleccion.node();
}
Insert cell
selectedSchool = {
function filtrar(arr){
for(var i = 0; i < schoolsInCity.length; i++){
if(arr[i].key == colegio.value){
return arr[i].values;
}
}
}
return filtrar(schoolsInCity)
}
Insert cell
datosPorMostrar = {
if(colegio.value != "COLEGIO"){
return selectedSchool;
}
else if(colegio.value == "COLEGIO" && ciudad.value != "CIUDAD"){
return ;
}
else if(colegio.value == "COLEGIO" && ciudad.value == "CIUDAD" && departamento.value == "DEPARTAMENTO"){
return ;
}
else {
}
}
Insert cell
columns = ['punt_lectura_critica', 'punt_matematicas', 'punt_c_naturales', 'punt_sociales_ciudadanas', 'punt_ingles']
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more