Public
Edited
Sep 25, 2024
1 fork
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
EA_COLORES = [
'#FF7D7E', '#F7A5C1', '#CD93D8', '#A389D4', '#707DC8',
'#5AB1F6', '#69CBF9', '#66D7E5', '#59BBB1', '#8BCB8D',
'#b5d788', '#DEE87E', '#FFF280', '#FFD75E', '#FFBD59', // Nota: Codigo de "light green" esta mal en el screenshot de la guia
'#FF926F', '#A89088', '#A8A8A8' , '#A9B7C0', '#808080',
]
Insert cell
EA_COLORES_NOMBRES = [
'RED', 'PINK', 'PURPLE', 'VIOLET', 'INDIGO',
'BLUE', 'LIGHT BLUE', 'AQUA', 'TEAL', 'GREEN',
'LIGHT GREEN', 'LIME', 'YELLOW', 'AMBER', 'ORANGE',
'TANGERINE', 'BROWN', 'GREY', 'BLUE GREY', 'DARK GREY',
]
Insert cell
Insert cell
Insert cell
EA_COLORES_DETALLADO = {
return EA_COLORES.map((color_hex, i) => {
return {
name: EA_COLORES_NOMBRES[i],
value: color_hex,
value_lch: d3.lch(color_hex),
}
})
}
Insert cell
Insert cell
Insert cell
Insert cell
htl.html`
${swatches('P85', Object.values(P85_COLORES_MAP))}
`
Insert cell
P85_COLORES_MAP = Object({
AZUL:'#383f56',
GRIS:'#7D8A90',
CASIBLANCO:'#f5f5f5',
CREMAVIEJO:'#c2b5aa',
// VIOLETA:'#702283',
VIOLETA:'#764a98',
ROSA:'#dc73ab',
NARANJA:'#f28a04',
ELQUETUQUIERA:'#d8d8de',
TERRACOTA:'#b97860', // HCL: 28, 53, 57
AZULCLARO:'#8eb8cf', // HCL: 228, 32, 73
// AZULCLARO: d3.hcl(228, 40, 73).hex(),
})
Insert cell
d3.hcl(228, 32, 73).toHex
Insert cell
Insert cell
// Para añadir datos a un objeto Geojson en una propiedad nueva
function add_data_to_geojson(geojson, data, join_key, prop_name = 'data') {
const gj = structuredClone(geojson);

const data_map = {};
data.forEach(d => {
data_map[d[join_key]] = d
});

for (let f of gj.features) {
const p = f.properties;
p[prop_name] = data_map[p[join_key]]
}

return gj
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more