fix: Correcion del grafico estados al aplicar el filtro de genero

This commit is contained in:
Hectorgh24 2025-06-16 00:36:51 -06:00
parent 9e6f346258
commit d58a293072
1 changed files with 25 additions and 0 deletions

View File

@ -256,12 +256,28 @@ async function actualizarTodosLosGraficos() {
}]);
}
// Actualizar gráfico de estados
const datosEstados = await obtenerDatosEstados(filtros);
if (chartEstados) {
chartEstados.updateOptions({
xaxis: {
categories: datosEstados.map(d => d.estado)
}
});
chartEstados.updateSeries([{
name: 'Cantidad',
data: datosEstados.map(d => d.cantidad)
}]);
}
// Actualizar otros gráficos...
}
// Agregar event listeners para los filtros
document.addEventListener('DOMContentLoaded', function() {
const selectExamen = document.getElementById('id_examen');
const selectGenero = document.getElementById('id_genero');
if (selectExamen) {
selectExamen.addEventListener('change', function() {
if (this.value !== "NULL") {
@ -270,6 +286,15 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
}
if (selectGenero) {
selectGenero.addEventListener('change', function() {
if (this.value !== "NULL") {
setFiltroActivo('id_genero');
actualizarTodosLosGraficos();
}
});
}
});
export {