diff --git a/index.html b/index.html index 640b082..d3c815c 100644 --- a/index.html +++ b/index.html @@ -1252,8 +1252,15 @@ const GraphView = { area.innerHTML = '
'; const container = area.querySelector(".graph-container"); + // Count tags per category + const categoryCounts = new Map(); + tags.forEach(tag => { + const cat = Utils.getCategory(tag); + categoryCounts.set(cat, (categoryCounts.get(cat) || 0) + 1); + }); + this.renderSVG(container, nodes, links); - this.renderSidebar(container, nodes.length, links.length); + this.renderSidebar(container, nodes.length, links.length, categoryCounts); this.renderControls(container); this.renderLegend(container); }, @@ -1330,10 +1337,19 @@ const GraphView = { .on("end", (e, d) => { if (!e.active) sim.alphaTarget(0); d.fx = null; d.fy = null; }); }, - renderSidebar(container, nodeCount, edgeCount) { + renderSidebar(container, nodeCount, edgeCount, categoryCounts) { const { graphFilters, graphSettings } = State.get(); const sidebar = document.createElement("div"); sidebar.className = "graph-sidebar"; + + // Only show categories that have tags in current data + const categoryHTML = Object.entries(CONFIG.CATEGORIES) + .filter(([key]) => categoryCounts.has(key) && categoryCounts.get(key) > 0) + .map(([key, val]) => { + const count = categoryCounts.get(key) || 0; + return ``; + }).join(""); + sidebar.innerHTML = `
Stats
@@ -1342,7 +1358,7 @@ const GraphView = {
Categorías
- ${Object.entries(CONFIG.CATEGORIES).map(([key, val]) => ``).join("")} + ${categoryHTML || 'Sin categorías'}
Relaciones