88 < script src ="https://cdn.tailwindcss.com "> </ script >
99 <!-- Include ECharts -->
1010 < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/echarts.min.js "
> </ script > 11- <!-- Include Tippy.js para tooltips -->
12- < script src ="https://unpkg.com/@popperjs/core@2 "> </ script >
13- < script src ="https://unpkg.com/tippy.js@6 "> </ script >
1411 < style >
1512 # chart-container {
1613 width : 100% ;
4239 width : 20px ;
4340 height : 14px ;
4441 }
42+ /* Estilos para el panel de ayuda de filtros */
4543 .filter-info {
4644 display : inline-flex;
4745 align-items : center;
4846 justify-content : center;
4947 width : 18px ;
5048 height : 18px ;
5149 border-radius : 50% ;
52- background-color : rgba ( 255 , 255 , 255 , 0.3 ) ;
50+ background-color : # e5e7eb ;
5351 color : # 2563eb ;
5452 font-size : 12px ;
5553 font-weight : bold;
5654 cursor : pointer;
5755 margin-left : 4px ;
5856 }
59- .tippy-box {
60- background-color : # fff ;
61- color : # 333 ;
62- border : 1px solid # e2e8f0 ;
63- border-radius : 0.375rem ;
64- box-shadow : 0 4px 6px -1px rgba (0 , 0 , 0 , 0.1 ), 0 2px 4px -1px rgba (0 , 0 , 0 , 0.06 );
65- padding : 0.5rem ;
66- max-width : 300px !important ;
67- }
68- .tippy-box .tippy-content {
69- padding : 0.5rem ;
70- }
7157 .filter-help-panel {
72- background-color : rgba ( 245 , 247 , 250 , 0.9 ) ;
58+ background-color : # f8fafc ;
7359 border : 1px solid # e2e8f0 ;
7460 border-radius : 0.375rem ;
7561 padding : 1rem ;
7662 margin-bottom : 1rem ;
7763 font-size : 0.875rem ;
64+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.05 );
7865 }
7966 </ style >
8067</ head >
@@ -89,7 +76,7 @@ <h1 class="text-4xl font-bold">Histograma de Precios</h1>
8976 </ div >
9077 </ header >
9178 < main class ="p-6 ">
92- <!-- Información sobre filtros -->
79+ <!-- Panel de ayuda de filtros (oculto por defecto) -->
9380 < div id ="filter-help-panel " class ="filter-help-panel hidden ">
9481 < h4 class ="font-semibold mb-2 "> Tipos de filtrado disponibles:</ h4 >
9582 < ul class ="space-y-2 ">
@@ -110,7 +97,7 @@ <h4 class="font-semibold mb-2">Tipos de filtrado disponibles:</h4>
11097 < span > Permite examinar cada producto individualmente y elegir cuáles incluir o excluir del análisis.</ span >
11198 </ li >
11299 </ ul >
113- < button id ="close-filter-help " class ="mt-2 text-blue-600 underline text-sm "> Cerrar</ button >
100+ < button id ="close-filter-help " class ="mt-2 text-blue-600 hover:text-blue-800 text-sm "> Cerrar</ button >
114101 </ div >
115102
116103 <!-- Chart Tabs -->
@@ -272,38 +259,36 @@ <h4 class="font-semibold mb-2">Tipos de filtrado disponibles:</h4>
272259 } ) ;
273260 } ) ;
274261
275- // Configurar tooltips después de que se inicialice el gráfico
276- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
277- setTimeout ( ( ) => {
278- const filterControls = document . getElementById ( 'filter-controls' ) ;
279-
280- if ( filterControls ) {
281- // Añadir botón de ayuda junto al título del filtro
282- const filterTitle = filterControls . querySelector ( 'span.font-medium' ) ;
283- if ( filterTitle ) {
284- const helpButton = document . createElement ( 'span' ) ;
285- helpButton . className = 'filter-info' ;
286- helpButton . textContent = '?' ;
287- helpButton . id = 'filter-help-button' ;
288- filterTitle . appendChild ( helpButton ) ;
289-
290- // Configurar el evento click para mostrar/ocultar el panel de ayuda
291- helpButton . addEventListener ( 'click' , function ( ) {
292- const helpPanel = document . getElementById ( 'filter-help-panel' ) ;
293- helpPanel . classList . toggle ( 'hidden' ) ;
294- } ) ;
295- }
262+ // Configurar botón de ayuda para los filtros
263+ // Este script se ejecutará después de que chart.js haya añadido los controles de filtros
264+ setTimeout ( ( ) => {
265+ const filterControls = document . getElementById ( 'filter-controls' ) ;
266+ if ( filterControls ) {
267+ // Añadir botón de ayuda junto al título
268+ const filterTitle = filterControls . querySelector ( 'span.font-medium' ) ;
269+ if ( filterTitle ) {
270+ const helpButton = document . createElement ( 'span' ) ;
271+ helpButton . className = 'filter-info' ;
272+ helpButton . textContent = '?' ;
273+ helpButton . id = 'filter-help-button' ;
274+ filterTitle . appendChild ( helpButton ) ;
296275
297- // Configurar el botón para cerrar el panel de ayuda
298- const closeHelpBtn = document . getElementById ( 'close-filter-help' ) ;
299- if ( closeHelpBtn ) {
300- closeHelpBtn . addEventListener ( 'click' , function ( ) {
301- document . getElementById ( 'filter-help-panel' ) . classList . add ( 'hidden' ) ;
302- } ) ;
303- }
276+ // Configurar evento para mostrar/ocultar el panel de ayuda
277+ helpButton . addEventListener ( 'click' , function ( ) {
278+ const helpPanel = document . getElementById ( 'filter-help-panel' ) ;
279+ helpPanel . classList . toggle ( 'hidden' ) ;
280+ } ) ;
304281 }
305- } , 500 ) ; // Pequeño retraso para asegurar que los elementos existen
306- } ) ;
282+ }
283+
284+ // Configurar botón para cerrar el panel de ayuda
285+ const closeHelpBtn = document . getElementById ( 'close-filter-help' ) ;
286+ if ( closeHelpBtn ) {
287+ closeHelpBtn . addEventListener ( 'click' , function ( ) {
288+ document . getElementById ( 'filter-help-panel' ) . classList . add ( 'hidden' ) ;
289+ } ) ;
290+ }
291+ } , 500 ) ; // Pequeño retraso para que los elementos de chart.js estén disponibles
307292 } ) ;
308293 </ script >
309294
0 commit comments