Skip to content

Commit 6319dce

Browse files
committed
✅ Leyenda indices
1 parent 36791b9 commit 6319dce

File tree

1 file changed

+66
-4
lines changed

1 file changed

+66
-4
lines changed

aplicaciones/www/src/componentes/VisualizacionIndices.vue

+66-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const nombresIndices = {
1414
viviendaEmpleo: 'Vivienda y empleo',
1515
};
1616
const infoPunto: Ref<Punto | null> = ref(null);
17+
const infoLeyenda = ref(false);
1718
const posInfo = ref({ x: 0, y: 0 });
1819
1920
const indices: Ref<{ indicador: LlavesIndices; linea: string }[]> = ref([
@@ -36,9 +37,9 @@ watch(() => props.puntos, construirLineas);
3637
watch(() => props.ancho, construirLineas);
3738
watch(() => props.alto, construirLineas);
3839
39-
function mostrarInfoPunto(punto: Punto) {
40-
infoPunto.value = punto;
41-
}
40+
const mostrarInfoPunto = (punto: Punto) => (infoPunto.value = punto);
41+
const mostrarInfoLeyenda = () => (infoLeyenda.value = true);
42+
const esconderInfoLeyenda = () => (infoLeyenda.value = false);
4243
4344
function esconderInfoPunto() {
4445
infoPunto.value = null;
@@ -52,6 +53,7 @@ function construirLineas() {
5253
indices.value.forEach((indice) => {
5354
indice.linea = '';
5455
});
56+
5557
// Construir líneas de los indicadores
5658
for (let i = 0; i < props.puntos.length; i++) {
5759
const punto = props.puntos[i];
@@ -120,6 +122,20 @@ function construirLineas() {
120122
</div>
121123
</div>
122124

125+
<div
126+
id="leyendaIndices"
127+
@mouseenter="mostrarInfoLeyenda"
128+
@mouseleave="esconderInfoLeyenda"
129+
@mousemove="actualizarPosicionInfoPunto"
130+
:style="{ height: `${alto}px` }"
131+
>
132+
<span>1</span>
133+
<span>0.75</span>
134+
<span>0.50</span>
135+
<span>0.25</span>
136+
<span>0</span>
137+
</div>
138+
123139
<div id="info" :class="{ visible: infoPunto }" :style="{ top: `${posInfo.y}px`, left: `${posInfo.x}px` }">
124140
<div class="indicadores">
125141
<h4>{{ infoPunto?.nombre }}</h4>
@@ -136,6 +152,11 @@ function construirLineas() {
136152
</div>
137153
</div>
138154
</div>
155+
156+
<div id="infoLeyenda" :class="{ visible: infoLeyenda }" :style="{ top: `${posInfo.y}px`, left: `${posInfo.x}px` }">
157+
<p>Los indicadores de habitabilidad son una forma de medir la calidad de vida en un barrio o ciudad.</p>
158+
<p>Los valores van de 0 a 1, donde 1 es el mejor valor posible.</p>
159+
</div>
139160
</template>
140161

141162
<style lang="scss" scoped>
@@ -146,6 +167,47 @@ function construirLineas() {
146167
z-index: 10;
147168
}
148169
170+
#leyendaIndices {
171+
position: fixed;
172+
bottom: 5px;
173+
left: 0;
174+
z-index: 10;
175+
background: rgb(0, 255, 0);
176+
background: linear-gradient(180deg, rgba(0, 255, 0, 1) 0%, rgba(255, 0, 0, 1) 100%);
177+
font-weight: bold;
178+
height: 100%;
179+
width: 25px;
180+
display: flex;
181+
align-items: stretch;
182+
flex-direction: column;
183+
justify-content: space-between;
184+
text-align: center;
185+
font-size: 0.7em;
186+
cursor: help;
187+
188+
span {
189+
background-color: rgba(255, 255, 255, 0.5);
190+
pointer-events: none;
191+
}
192+
}
193+
194+
#infoLeyenda {
195+
position: fixed;
196+
top: 0;
197+
left: 0;
198+
z-index: 10;
199+
background-color: var(--lila);
200+
padding: 0.5em 1em;
201+
font-size: 0.8em;
202+
width: 200px;
203+
display: none;
204+
transform: translate(10px, -100%);
205+
206+
&.visible {
207+
display: block;
208+
}
209+
}
210+
149211
#graficaIndices {
150212
position: absolute;
151213
top: 0;
@@ -181,7 +243,7 @@ function construirLineas() {
181243
182244
#contenedorEtiquetas {
183245
bottom: 10px;
184-
left: 10px;
246+
left: 30px;
185247
padding: 0.4em;
186248
position: fixed;
187249
background-color: rgba(255, 255, 255, 0.2);

0 commit comments

Comments
 (0)