graph.cpp
functional
memory
string
utility
vector
ftxui/dom/elements.hpp
ftxui/dom/node.hpp
ftxui/dom/requirement.hpp
ftxui/screen/box.hpp
ftxui/screen/screen.hpp
ftxui/dom/canvas.hpp
ftxui/dom/deprecated.hpp
ftxui/dom/direction.hpp
ftxui/dom/elements.hpp
ftxui/dom/flexbox_config.hpp
ftxui/dom/linear_gradient.hpp
ftxui/dom/node.hpp
ftxui/dom/requirement.hpp
ftxui/dom/selection.hpp
ftxui/screen/box.hpp
ftxui/screen/color.hpp
ftxui/screen/image.hpp
ftxui/screen/pixel.hpp
ftxui/screen/screen.hpp
ftxui/screen/string.hpp
ftxui/screen/terminal.hpp
ftxui/util/autoreset.hpp
ftxui/util/ref.hpp
src/ftxui/dom/graph.cpp
cstddef
cstdint
ftxui/dom/take_any_args.hpp
functional
memory
optional
sstream
string
unordered_map
utility
variant
vector
ftxui

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<functional>//forfunction
    #include<memory>//forallocator,make_shared
    #include<string>//forstring
    #include<utility>//formove
    #include<vector>//forvector

    #include"ftxui/dom/elements.hpp"//forGraphFunction,Element,graph
    #include"ftxui/dom/node.hpp"//forNode
    #include"ftxui/dom/requirement.hpp"//forRequirement
    #include"ftxui/screen/box.hpp"//forBox
    #include"ftxui/screen/screen.hpp"//forScreen

    namespaceftxui{

    namespace{
    //NOLINTNEXTLINE
    staticstd::stringcharset[]=
    #ifdefined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
    //Microsoft'sterminalsoftenusefontsnothandlingthe8unicode
    //charactersforrepresentingthewholegraph.Fallbackwithless.
    {"","","█","","█","█","█","█","█"};
    #else
    {"","▗","▐","▖","▄","▟","▌","▙","█"};
    #endif

    classGraph:publicNode{
    public:
    explicitGraph(GraphFunctiongraph_function)
    :graph_function_(std::move(graph_function)){}

    voidComputeRequirement()override{
    requirement_.flex_grow_x=1;
    requirement_.flex_grow_y=1;
    requirement_.flex_shrink_x=1;
    requirement_.flex_shrink_y=1;
    requirement_.min_x=3;
    requirement_.min_y=3;
    }

    voidRender(Screen&screen)override{
    constintwidth=(box_.x_max-box_.x_min+1)*2;
    constintheight=(box_.y_max-box_.y_min+1)*2;
    if(width<=0||height<=0){
    return;
    }
    autodata=graph_function_(width,height);
    inti=0;
    for(intx=box_.x_min;x<=box_.x_max;++x){
    constintheight_1=2*box_.y_max-data[i++];
    constintheight_2=2*box_.y_max-data[i++];
    for(inty=box_.y_min;y<=box_.y_max;++y){
    constintyy=2*y;
    inti_1=yy<height_1?0:yy==height_1?3:6;//NOLINT
    inti_2=yy<height_2?0:yy==height_2?1:2;//NOLINT
    screen.at(x,y)=charset[i_1+i_2];//NOLINT
    }
    }
    }

    private:
    GraphFunctiongraph_function_;
    };

    }//namespace

    ///@briefDrawagraphusingaGraphFunction.
    ///@paramgraph_functionthefunctiontobecalledtogetthedata.
    Elementgraph(GraphFunctiongraph_function){
    returnstd::make_shared<Graph>(std::move(graph_function));
    }

    }//namespaceftxui