Class Figure

Class Documentation

class Figure

Public Functions

template <class T>
void add(T &plot)

Add plot data to the figure.

Template Parameters
  • T: type of the plot data to add
  • plot:

void setLayout(Layout &lay)

Add layout data to the figure.

void write(std::string file_name, bool append_extension = true, bool print_to_stdout = false)

Write the figure to a file.

CAUTION: Overwrites any existing file contents.

  • file_name: The file name to write to, including any absolute or relative path
  • append_extension: If true, a .json extension will be appended to file_name (if not already present)
  • print_to_stdout: Default false. If true, the json will also be printed to std::cout (useful for debugging)

Public Members

std::string id = ""

Optional metadata - Figure ID.

std::string name = ""

Optional metadata - Figure name used for display (e.g. in cpplot-viewer)

std::string short_caption = ""

Optional metadata - Short_caption used in report contents tables.

std::string caption = ""

Optional metadata - Long caption used beside the figure (e.g. in a report)

Protected Attributes

nlohmann::json data
nlohmann::json layout
nlohmann::json meta