XCoreGrid
XCoreGrid is a Monitor widget in LightGUI's XFrame widget set. A grid of mini history graphs, one per CPU core.
XCoreGrid lays out one small scrolling history graph per CPU core, each with its label and current percentage. It reads the core count itself, so the same code shows 4 cores on a laptop and 32 on a server. Push one percentage per core (or all of them at once) and each cell scrolls on its own.

Key methods
push(core, pct)— append a percentage sample for one corepush_all(pcts)— append one sample for every core at onceensure_cores()— re-read the core count and rebuild the grid
Every widget also gets the shared properties visible, enabled, bounds (x, y, width, height) and style_name, plus the background / foreground colours from the active style.
Example
One push per core per tick; the grid labels and scales each cell itself.
XCoreGrid widget(display, screen, window, gc, &styles, 20, 20, 720, 480);
widget.push(0, 42.0); // core 0 at 42%
widget.push_all({12.0, 87.0, 45.0, 63.0}); // all cores at once
widget.draw();The snippet above is the widget part only. As with every XFrame example, the full program opens a display, creates a window and a style manager, then runs the standard event loop — see the complete example in the repo.
Build it from the repo root:
g++ -std=c++17 -Iwidgets/components -Iwidgets examples/XCoreGrid.cpp -lX11 -o XCoreGridRun it under Xvfb or a real X server; close the window to quit.
Example in the repo
The full working example is examples/XCoreGrid.cpp in the lightgui repo (C is canonical). The same widget is ported to the Rust and Python repos under the same name — see the links below.
Get the code
These widgets ship in all three LightGUI repos:
- lightgui (C)
- lightgui_rust (Rust)
- lightgui_python (Python)