21#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
24 {
" ",
" ",
"█",
" ",
"█",
"█",
"█",
"█",
"█"};
26 {
" ",
"▗",
"▐",
"▖",
"▄",
"▟",
"▌",
"▙",
"█"};
29class Graph :
public Node {
34 void ComputeRequirement()
override {
35 requirement_.flex_grow_x = 1;
36 requirement_.flex_grow_y = 1;
37 requirement_.flex_shrink_x = 1;
38 requirement_.flex_shrink_y = 1;
39 requirement_.min_x = 3;
40 requirement_.min_y = 3;
44 const int width = (box_.x_max - box_.x_min + 1) * 2;
45 const int height = (box_.y_max - box_.y_min + 1) * 2;
46 if (width <= 0 || height <= 0) {
49 auto data = graph_function_(width, height);
51 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
54 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
std::shared_ptr< Node > Element
std::shared_ptr< T > Make(Args &&... args)
std::function< std::vector< int >(int, int)> GraphFunction
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Element graph(GraphFunction)
Draw a graph using a GraphFunction.