Files
fn_registry/cpp/functions/viz/kpi_card.h
T
egutierrez b9716a7cd6 chore: snapshot WIP previo + flow 0008 + 7 sub-issues (0112-0119)
Snapshot de WIP acumulado de sesiones previas antes de merge wave 1
del flow 0008 (kanban_cpp + agent_runner_api + DoD schema).

Incluye:
- dev/flows/0008-kanban-cpp-and-agent-workflows.md
- dev/issues/0112-0119*.md (7 sub-issues)
- WIP previo en cmd/fn/doctor.go, registry/*, modules/, cpp/, etc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 18:17:08 +02:00

28 lines
1.1 KiB
C

#pragma once
// KPI card — displays a key metric with trend.
// Usage:
// #include "core/icons_tabler.h"
// float history[] = {10, 12, 11, 15, 18, 17, 20};
// kpi_card("Revenue", 20000.0f, 12.5f, history, 7, "$%.0f", TI_CASH);
//
// Shows:
// - Optional icon (Tabler glyph) + label (small, muted) on top row
// - Value (large font)
// - Delta badge (green TI_TRENDING_UP / red TI_TRENDING_DOWN)
// - Sparkline of history (auto Y by default; fixed Y in overload v1.4)
void kpi_card(const char* label, float value, float delta_percent,
const float* history = nullptr, int history_count = 0,
const char* format = "%.1f",
const char* icon = nullptr);
// Fixed Y-scale variant (v1.4): el sparkline interno usa [y_min, y_max]
// absolutos. Util para metricas con dominio conocido (CPU%/RAM% -> 0,100)
// donde la comparacion visual entre cards exige misma escala.
void kpi_card(const char* label, float value, float delta_percent,
const float* history, int history_count,
float y_min, float y_max,
const char* format = "%.1f",
const char* icon = nullptr);