7c95b36a5f
Auditoria del issue 0044: 9 archivos .md de cpp/functions/viz/ con uses_functions actualizado. Resuelve dependencias detectadas via #include: plot_static (consumido por bar_chart, histogram, line_plot, pie_chart, scatter_plot), gl_loader, gl_framebuffer, gl_shader, graph_force_layout, graph_renderer, graph_spatial_hash, orbit_camera, sparkline y tokens. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.6 KiB
2.6 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, framework, params, output, notes
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | framework | params | output | notes | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bar_chart | component | cpp | viz | 1.2.0 | pure | void bar_chart(const char* title, const char* const* labels, const float* values, int count, float bar_width = 0.67f, float height = 200.0f) | Barras verticales ImPlot con ejes pineados, altura explicita, tooltip al hover y auto-rotacion 45 de labels cuando no caben horizontales |
|
|
false |
|
false | cpp/functions/viz/bar_chart.cpp | imgui |
|
Renderiza barras, tooltip al hover con label+valor, y si los labels horizontales no caben los dibuja rotados 45 grados | consumido por cpp/apps/chart_demo/main.cpp; scaffolding/demo en primitives_gallery |
bar_chart
Barras verticales ImPlot pensadas para dashboards. Tres cosas no triviales:
- Ejes pineados —
plot_static::kPlotFlags+kAxisFlags(Lock + NoInitialFit + Cond_Always) cony_maxpre-calculado + 15% headroom. Sin esto ImPlot auto-fitea cada frame y las barras oscilan. - Tooltip — si
IsPlotHovered(), detecta la barra bajo el cursor (round(mouse.x)con toleranciabar_width/2) y muestralabel+ valor. - Labels auto-rotados — mide la suma de
CalcTextSize(label) + 12pxcontra el ancho del plot; si no caben, dibuja los labels rotados 45° manualmente conImDrawList::PrimQuadUV+ glyphs del font atlas (ImFontBaked::FindGlyph— API ImGui 1.92+). Reserva 48px abajo del plot para los labels rotados. Si caben se usan los ticks horizontales normales de ImPlot.
Altura explicita (height) rompe el feedback loop con contenedores AutoResizeY (ver viz/plot_static.h).
Ejemplo
const char* domains[] = {"core", "finance", "cybersecurity", "datascience", "infra"};
float counts[] = {412, 187, 94, 63, 36};
bar_chart("##domains", domains, counts, 5); // horizontal si cabe
bar_chart("##domains", domains, counts, 5, 0.8f, 240); // rotated si no cabe