@@ -14,6 +14,7 @@ const nombresIndices = {
14
14
viviendaEmpleo: ' Vivienda y empleo' ,
15
15
};
16
16
const infoPunto: Ref <Punto | null > = ref (null );
17
+ const infoLeyenda = ref (false );
17
18
const posInfo = ref ({ x: 0 , y: 0 });
18
19
19
20
const indices: Ref <{ indicador: LlavesIndices ; linea: string }[]> = ref ([
@@ -36,9 +37,9 @@ watch(() => props.puntos, construirLineas);
36
37
watch (() => props .ancho , construirLineas );
37
38
watch (() => props .alto , construirLineas );
38
39
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 );
42
43
43
44
function esconderInfoPunto() {
44
45
infoPunto .value = null ;
@@ -52,6 +53,7 @@ function construirLineas() {
52
53
indices .value .forEach ((indice ) => {
53
54
indice .linea = ' ' ;
54
55
});
56
+
55
57
// Construir líneas de los indicadores
56
58
for (let i = 0 ; i < props .puntos .length ; i ++ ) {
57
59
const punto = props .puntos [i ];
@@ -120,6 +122,20 @@ function construirLineas() {
120
122
</div >
121
123
</div >
122
124
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
+
123
139
<div id =" info" :class =" { visible: infoPunto }" :style =" { top: `${posInfo.y}px`, left: `${posInfo.x}px` }" >
124
140
<div class =" indicadores" >
125
141
<h4 >{{ infoPunto?.nombre }}</h4 >
@@ -136,6 +152,11 @@ function construirLineas() {
136
152
</div >
137
153
</div >
138
154
</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 >
139
160
</template >
140
161
141
162
<style lang="scss" scoped>
@@ -146,6 +167,47 @@ function construirLineas() {
146
167
z-index : 10 ;
147
168
}
148
169
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
+
149
211
#graficaIndices {
150
212
position : absolute ;
151
213
top : 0 ;
@@ -181,7 +243,7 @@ function construirLineas() {
181
243
182
244
#contenedorEtiquetas {
183
245
bottom : 10px ;
184
- left : 10 px ;
246
+ left : 30 px ;
185
247
padding : 0.4em ;
186
248
position : fixed ;
187
249
background-color : rgba (255 , 255 , 255 , 0.2 );
0 commit comments