cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
toolbox::utils::plot_t Class Reference

#include <plot.hpp>

Classes

struct  axis_t
 
struct  series_t
 

Public Types

enum class  axis_scale_t { LINEAR , LOG }
 
enum class  style_t : char { STAR = '*' , DOT = '.' , PLUS = '+' , CROSS = 'x' }
 

Public Member Functions

void add_line_series (const std::vector< double > &xs, const std::vector< double > &ys, color_t color=color_t::DEFAULT, style_t style=style_t::STAR)
 
void add_scatter_series (const std::vector< double > &xs, const std::vector< double > &ys, color_t color=color_t::DEFAULT, style_t style=style_t::DOT)
 
void set_x_axis (axis_scale_t scale=axis_scale_t::LINEAR, std::string label="")
 设置 X 轴 / Configure the X axis
 
void set_y_axis (axis_scale_t scale=axis_scale_t::LINEAR, std::string label="")
 设置 Y 轴 / Configure the Y axis
 
void set_title (std::string title)
 设置标题 / Set plot title
 
void enable_axis_grid (bool enable=true, color_t color=color_t::WHITE)
 开启或关闭轴网格 / Toggle axis grid
 
void enable_global_grid (bool enable=true, color_t color=color_t::CYAN)
 开启或关闭全局网格 / Toggle global grid
 
std::string render (size_t width=60, size_t height=20) const
 

Member Enumeration Documentation

◆ axis_scale_t

Enumerator
LINEAR 
LOG 

◆ style_t

enum class toolbox::utils::plot_t::style_t : char
strong
Enumerator
STAR 
DOT 
PLUS 
CROSS 

Member Function Documentation

◆ add_line_series()

void toolbox::utils::plot_t::add_line_series ( const std::vector< double > &  xs,
const std::vector< double > &  ys,
color_t  color = color_t::DEFAULT,
style_t  style = style_t::STAR 
)

添加折线数据 / Add line series

◆ add_scatter_series()

void toolbox::utils::plot_t::add_scatter_series ( const std::vector< double > &  xs,
const std::vector< double > &  ys,
color_t  color = color_t::DEFAULT,
style_t  style = style_t::DOT 
)

添加散点数据 / Add scatter series

◆ enable_axis_grid()

void toolbox::utils::plot_t::enable_axis_grid ( bool  enable = true,
color_t  color = color_t::WHITE 
)

开启或关闭轴网格 / Toggle axis grid

◆ enable_global_grid()

void toolbox::utils::plot_t::enable_global_grid ( bool  enable = true,
color_t  color = color_t::CYAN 
)

开启或关闭全局网格 / Toggle global grid

◆ render()

std::string toolbox::utils::plot_t::render ( size_t  width = 60,
size_t  height = 20 
) const

渲染为字符串 / Render as string

◆ set_title()

void toolbox::utils::plot_t::set_title ( std::string  title)

设置标题 / Set plot title

◆ set_x_axis()

void toolbox::utils::plot_t::set_x_axis ( axis_scale_t  scale = axis_scale_t::LINEAR,
std::string  label = "" 
)

设置 X 轴 / Configure the X axis

◆ set_y_axis()

void toolbox::utils::plot_t::set_y_axis ( axis_scale_t  scale = axis_scale_t::LINEAR,
std::string  label = "" 
)

设置 Y 轴 / Configure the Y axis


The documentation for this class was generated from the following file: