--- id: 0079 title: tables playground — drill-through extendido (fase 10) status: done priority: medium created: 2026-05-12 closed: 2026-05-12 related_components: [cpp/apps/primitives_gallery/playground/tables] --- ## Contexto Fase 10 del roadmap del tables playground. Drill-down basico ya implementado (`make_drill_filter` + chip de filtro en stage previo). Falta granularidad de zoom, presets rapidos, click sobre elementos del chart, historial de drill y row inspector. ## Cambios ### 1. Zoom granularity sobre cols Date - Detectar col tipo `Date` en breakout. - Combo en chip de breakout: "year / month / week / day / hour". - Pure fn `truncate_date_cpp_core(date_str, granularity) -> string`. - Stage 1 con breakout `:month` agrega valores formateados al granular. - TQL: `breakout = {"col:month"}` (sufijo despues de `:`). - Auto-detect granularity inicial: si rango > 2 anios -> year; > 60 dias -> month; > 14 dias -> week; resto -> day. ### 2. Quick filter presets - Boton "Presets" en chip row de filtros. - Menu con: - "Top 10 by " (auto-sugiere col numerica) - "Last 7 / 30 / 90 dias" (si hay col Date) - "Exclude nulls in " - "Non-zero only" - Aplica como filtros al stage activo. ### 3. Click-to-drill sobre chart elements - Bar/Column/Pie/Funnel: click en elemento -> `make_drill_filter(col_idx, value)` -> push filter en stage previo, `active_stage--`. - Scatter/Bubble: click en punto -> filter por X y Y rangos cercanos (snap to nearest data point) o muestra row inspector. - Heatmap: click en celda -> filtro por par (row, col). - ImPlot api: `ImPlot::IsPlotHovered() + GetPlotMousePos()`. Hit-test propio para barras. ### 4. Drill history (back/forward) - Pila de `DrillStep { stage_idx, filter_added }` en `UiState.drill_history`. - Botones `<` `>` en breadcrumb para back/forward. - TQL preserva el stage agrupado pero no la history (es UI state efimero). ### 5. Row inspector - Click derecho sobre row de tabla o punto de chart -> popup modal con todas las cols + valores de la fila. - Incluye cols ocultas. - Solo lectura. Boton "Copy as TSV" + "Filter by this row". ### 6. Drill-up: vuelve un stage atras sin perder filtros nuevos - Boton `<` en breadcrumb del stage previo: pushdown del filter actual al stage anterior + active--. - Inverso de drill-down. Usuario navega la jerarquia sin perder camino. ## Tests - `truncate_date_cpp_core` para granularities (round-trip por fecha conocida). - Pure fn de quick filter presets (build `vector` desde preset id). - Round-trip TQL con breakout sufijo `:month`. ## No-objetivos - Map drill (lat/lng -> region) — fuera de scope. - Cross-filter entre paneles (click en panel A filtra panel B) — fase futura.