Módulo con los escaños por provincia
Contenido actualizado
Cargando visualización...
${displayName} ${votes} | ${prevPct}% | ${pct}% | ${difIcon}${difText} | `; } return `
`; } }, series: [{ name: 'Municipios', type: 'map', map: 'Andalucia', roam: true, layoutCenter: ['50%', '50%'], layoutSize: '95%', itemStyle: { borderColor: '#ffffff', borderWidth: 0.5, opacity: 1 }, emphasis: { focus: 'none', itemStyle: { areaColor: null, borderColor: '#333333', borderWidth: 1.5 }, label: { show: false } }, blur: { itemStyle: { opacity: 1 } }, data: mapData }] }; chart.setOption(option); } function setupSearch() { const input = document.getElementById('search-muni'); const results = document.getElementById('search-results'); input.addEventListener('input', (e) => { const val = normalize(e.target.value); if (!val) { results.style.display = 'none'; return; } const filtered = allMunis.filter(m => normalize(m.name).includes(val) ).slice(0, 10); if (filtered.length > 0) { results.innerHTML = filtered.map(m => `
${m.name}
`).join(''); results.style.display = 'block'; } else { results.style.display = 'none'; } }); document.addEventListener('click', (e) => { if (!input.contains(e.target)) results.style.display = 'none'; }); } function normalize(s) { return s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } window.selectMuni = (name, key) => { document.getElementById('search-results').style.display = 'none'; document.getElementById('search-muni').value = name; const center = muniCenters[name]; if (center) { chart.setOption({ series: [{ name: 'Municipios', center: center, zoom: 8 }] }); } // Show tooltip chart.dispatchAction({ type: 'showTip', seriesIndex: 0, name: name }); chart.dispatchAction({ type: 'highlight', seriesIndex: 0, name: name }); }; function handleZoom(scale) { const opt = chart.getOption(); const s = opt.series[0]; s.zoom = (s.zoom || 1) * scale; chart.setOption({ series: [s] }); } init();
Módulo con el porcentaje