Skip to content

Commit

Permalink
Merge pull request #11 from representacion/feature/selector
Browse files Browse the repository at this point in the history
Feature/selector
  • Loading branch information
martinszy authored Aug 28, 2024
2 parents 5eebf8a + 976b0ca commit 637090f
Show file tree
Hide file tree
Showing 229 changed files with 896 additions and 843 deletions.
497 changes: 256 additions & 241 deletions deteccion_color.ipynb

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fotos/color_promedio/0103__PAULO_GONZALO_MARTINEZ_LOPEZ__PAN_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fotos/color_promedio/0206__MARCELLO_HINOJOSA_JIMÉNEZ__MC_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fotos/color_promedio/0707__AZUCENA_ARREOLA_TRINIDAD__Morena_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fotos/color_promedio/1111__MIGUEL_ANGEL_SALIM_ALLE__PAN_0.jpg
Binary file modified fotos/color_promedio/1203__MA_0.jpg
Binary file modified fotos/color_promedio/1301__DANIEL_ANDRADE_ZURUTUZA__MORENA_0.jpg
Binary file modified fotos/color_promedio/1303__Tatiana_Tonantzin_P_0.jpg
Binary file modified fotos/color_promedio/1306__RICARDO_CRESPO_ARROYO__Morena_0.jpg
Binary file modified fotos/color_promedio/1405__BRUNO_BLANCAS_MERCADO__Morena_0.jpg
Binary file modified fotos/color_promedio/1531__JUAN_ANGEL_BAUTISTA_BRAVO__MORENA_0.jpg
Binary file modified fotos/color_promedio/1601__LEONEL_GODOY_RANGEL__MORENA_0.jpg
Binary file modified fotos/color_promedio/1703__Cindy_Winkler_Trujillo__PVEM_0.jpg
Binary file modified fotos/color_promedio/2702__IVAN_PENA_VIDAL__MORENA_0.jpg
Binary file modified fotos/color_promedio/2705__BEATRIZ_MILLAND_PEREZ__MORENA_0.jpg
12 changes: 11 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -23,6 +23,16 @@
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4">
<label for="selector-color">Elige un clasificación:</label>

<select name="color" id="selector-color" class="form-select" aria-label="Selector de clasificación de color">
<option value="perla">Perla</option>
<option value="kmedias">K-medias</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h1>Mapa de tonos de piel</h1>
Expand Down
32 changes: 30 additions & 2 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ let svg = div.append("svg")

const datap = d3.json("./resources/datos/mexico300-2024.geojson");
const datae = d3.json("./resources/datos/mexico300bordes-2024.geojson");
let distdata_base = []
d3.csv("./resources/datos/distdata_base.csv").then(datum=>distdata_base=datum);

const distdata = d3.csv("./resources/datos/distdata.csv");

let listado = "";
Expand Down Expand Up @@ -96,13 +99,19 @@ let pintar = Promise.all([datap,datae,distdata]).then(function(data) {

for (let d in datos) {
if (datos[d].PHOTO_URL) {
listado += `<div style="display: inline-block; width: 300px; float: left;"><img width="250" src="photos/${datos[d].PHOTO_URL}">
<div style='display: inline-block; background-color: ${datos[d].SKIN_TONE}; width: 100px; height: 100px;'>perla</div><div style='display: inline-block; background-color: ${datos[d].DOMINANT}; width: 100px; height: 100px;'>dominante</div>
listado += `<div style="display: inline-block; width: 300px; float: left; border: 1px solid #ccc; font-size: 10px">
<div>
<img src="photos/${datos[d].PHOTO_URL}" style="max-height: 250px; max-width: 280px; height: 250px;">
</div>
<div style='display: inline-block; background-color: ${datos[d].SKIN_TONE}; width: 90px; height: 100px;'>perla</div>
<div style='display: inline-block; background-color: ${datos[d].DOMINANT}; width: 90px; height: 100px;'>dominante</div>
<div style='display: inline-block; background-color: ${datos[d].TONO_PIEL_KMEDIAS}; width: 90px; height: 100px;'>kmedias</div>
Distrito ${datos[d].CVEDIS} -
<b>Estado ${datos[d].NOMBRE_ENTIDAD}</b><br>
${datos[d].NOMBRE_DISTRITO_FEDERAL}<br>
[${datos[d].PARTIDO_2024}]
${datos[d].NOMBRE_DIPUTADO_ELECTO_2024}
<br>
<a href="https://www.gobernantes.info/mx/person/${datos[d].ID_PERSON_GOBERNANTES}">Ver en gobernantes</a>
</div>
`
Expand Down Expand Up @@ -159,3 +168,22 @@ let pintar = Promise.all([datap,datae,distdata]).then(function(data) {
d3.select("#barra").append("p").html("Hombres: " + d3.format(",.0f")(dato["LN_MUJERES"]))
}

let selector =document.querySelector("#selector-color")
selector.addEventListener("change",cambiaClasificacionColor)
function cambiaClasificacionColor(){
if(selector.value == "kmedias"){
d3.selectAll("g.distrito_group").selectAll("path")
.style("fill", d => {
// console.log("d",d);
let color = distdata_base.filter(datum=>datum.CVEDIS==d.properties.distrito.toString())[0]
console.log(color)

// console.log(d["properties"]["distrito"],dato.SKIN_TONE)
return color.TONO_PIEL_KMEDIAS;

})
}
else{
console.log("e")
}
}
602 changes: 301 additions & 301 deletions resources/datos/distdata.csv

Large diffs are not rendered by default.

596 changes: 298 additions & 298 deletions resources/datos/distdata_base.csv

Large diffs are not rendered by default.

0 comments on commit 637090f

Please sign in to comment.