53402d84d5
Wave 1 de parallel-fix-issues integrada a master: - 0025: text_editor_cpp_core + file_watcher_cpp_core - 0026: gl_texture_load_cpp_gfx (vendor: stb_image v2.30) Ademas se commitea WIP previo de master que estaba sin commitear (cambios en shaders_lab, dag_*, framework, tokens, kpi_card, gl_loader.md, etc.) para dejar HEAD buildable. Notas: - Algunos deps del gallery (button.cpp, toolbar.cpp, modal_dialog.cpp...) siguen UNTRACKED — gating con FN_BUILD_GALLERY=ON (default OFF) para que master build (sin flag) no los necesite. - Build OK con y sin flag. fn index registra 904 functions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
82 lines
2.6 KiB
C++
82 lines
2.6 KiB
C++
#include "app_base.h"
|
|
#include "imgui.h"
|
|
#include "implot.h"
|
|
|
|
#include "viz/line_plot.h"
|
|
#include "viz/scatter_plot.h"
|
|
#include "viz/bar_chart.h"
|
|
#include "viz/heatmap.h"
|
|
#include "core/app_menubar.h"
|
|
|
|
#include <cmath>
|
|
#include <vector>
|
|
|
|
// Generate sample data
|
|
static constexpr int N = 500;
|
|
static float xs[N], ys_sin[N], ys_cos[N];
|
|
static float scatter_x[200], scatter_y[200];
|
|
static const char* bar_labels[] = {"Go", "Python", "Bash", "TypeScript", "C++"};
|
|
static float bar_values[] = {201.0f, 202.0f, 38.0f, 80.0f, 5.0f};
|
|
static float heat_data[10 * 10];
|
|
|
|
static bool data_initialized = false;
|
|
|
|
static void init_data() {
|
|
if (data_initialized) return;
|
|
for (int i = 0; i < N; i++) {
|
|
xs[i] = static_cast<float>(i) * 0.02f;
|
|
ys_sin[i] = sinf(xs[i]);
|
|
ys_cos[i] = cosf(xs[i]);
|
|
}
|
|
for (int i = 0; i < 200; i++) {
|
|
scatter_x[i] = static_cast<float>(rand()) / RAND_MAX * 10.0f;
|
|
scatter_y[i] = scatter_x[i] * 0.5f + (static_cast<float>(rand()) / RAND_MAX - 0.5f) * 3.0f;
|
|
}
|
|
for (int i = 0; i < 100; i++) {
|
|
int r = i / 10, c = i % 10;
|
|
heat_data[i] = sinf(r * 0.5f) * cosf(c * 0.5f);
|
|
}
|
|
data_initialized = true;
|
|
}
|
|
|
|
static void render() {
|
|
init_data();
|
|
|
|
// MainMenuBar (solo Settings — chart_demo no tiene paneles toggleables)
|
|
fn_ui::app_menubar(nullptr, 0, nullptr);
|
|
|
|
// Full-window dockspace
|
|
ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport());
|
|
|
|
if (ImGui::Begin("fn_registry — Chart Demo")) {
|
|
if (ImGui::BeginTabBar("##charts")) {
|
|
if (ImGui::BeginTabItem("Line Plot")) {
|
|
ImGui::Text("sin(x) — %d points", N);
|
|
line_plot("Sine Wave", xs, ys_sin, N);
|
|
ImGui::EndTabItem();
|
|
}
|
|
if (ImGui::BeginTabItem("Scatter Plot")) {
|
|
ImGui::Text("y = 0.5x + noise — 200 points");
|
|
scatter_plot("Scatter Data", scatter_x, scatter_y, 200);
|
|
ImGui::EndTabItem();
|
|
}
|
|
if (ImGui::BeginTabItem("Bar Chart")) {
|
|
ImGui::Text("Functions per language in fn_registry");
|
|
bar_chart("Registry Languages", bar_labels, bar_values, 5);
|
|
ImGui::EndTabItem();
|
|
}
|
|
if (ImGui::BeginTabItem("Heatmap")) {
|
|
ImGui::Text("sin(r) * cos(c) — 10x10 matrix");
|
|
heatmap("Correlation Matrix", heat_data, 10, 10, -1.0f, 1.0f);
|
|
ImGui::EndTabItem();
|
|
}
|
|
ImGui::EndTabBar();
|
|
}
|
|
}
|
|
ImGui::End();
|
|
}
|
|
|
|
int main() {
|
|
return fn::run_app({.title = "fn_registry — Chart Demo", .width = 1400, .height = 900}, render);
|
|
}
|