73a4c3a148
Añade soporte C++ al registry: vendor submodules (glfw, imgui, implot, tracy), sistema de build con CMake y toolchains cross-platform, runner C++ en fn CLI, parser de tests Google Test, y funciones bash para build Linux/Windows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
952 B
C++
27 lines
952 B
C++
#include "viz/bar_chart.h"
|
|
#include "implot.h"
|
|
|
|
#include <vector>
|
|
|
|
void bar_chart(const char* title, const char* const* labels, const float* values, int count, float bar_width) {
|
|
if (ImPlot::BeginPlot(title, ImVec2(-1, 0))) {
|
|
std::vector<double> positions(count);
|
|
for (int i = 0; i < count; i++) positions[i] = i;
|
|
|
|
ImPlot::SetupAxisTicks(ImAxis_X1, positions.data(), count, labels);
|
|
ImPlot::PlotBars("##data", values, count, bar_width);
|
|
ImPlot::EndPlot();
|
|
}
|
|
}
|
|
|
|
void bar_chart(const char* title, const char* const* labels, const double* values, int count, double bar_width) {
|
|
if (ImPlot::BeginPlot(title, ImVec2(-1, 0))) {
|
|
std::vector<double> positions(count);
|
|
for (int i = 0; i < count; i++) positions[i] = i;
|
|
|
|
ImPlot::SetupAxisTicks(ImAxis_X1, positions.data(), count, labels);
|
|
ImPlot::PlotBars("##data", values, count, bar_width);
|
|
ImPlot::EndPlot();
|
|
}
|
|
}
|