BioDynaMo  v1.05.119-a4ff3934
Public Member Functions | Private Attributes | List of all members
bdm::experimental::LineGraph Class Reference

#include <line_graph.h>

Collaboration diagram for bdm::experimental::LineGraph:
[legend]

Public Member Functions

 LineGraph (const TimeSeries *ts, const std::string &title="", const std::string &xaxis_title="", const std::string &yaxis_title="", bool legend=true, TStyle *style=nullptr, int width=700, int height=500)
 
 ~LineGraph ()
 
TGraph * Add (const std::string &ts_name, const std::string &legend_name="", const char *add_mg_options="L", short line_color=1, float line_color_alpha=1.0, short line_style=1, short line_width=1, short marker_color=1, float marker_color_alpha=1.0, short marker_style=1, float marker_size=1, short fill_color=0, float fill_color_alpha=1.0, short fill_style=1000)
 
void SetLegendPos (real_t x1, real_t y1, real_t x2, real_t y2)
 
void SetLegendPosNDC (real_t x1, real_t y1, real_t x2, real_t y2)
 
void SetMultiGraphDrawOption (const std::string &s)
 
void Draw (const char *canvas_draw_option="")
 
void SaveAs (const std::string &filenpath_wo_extension, const std::vector< std::string > &extensions)
 
void Update ()
 
TCanvas * GetTCanvas ()
 
TMultiGraph * GetTMultiGraph ()
 
TLegend * GetTLegend ()
 
const std::vector< TGraph * > & GetTGraphs (const std::string &ts_name) const
 
TStyle * GetTStyle ()
 

Private Attributes

const TimeSeriests_ = nullptr
 
std::string mg_draw_option_ = "A"
 
TCanvas * c_ = nullptr
 
TMultiGraph * mg_ = nullptr
 
TLegend * l_ = nullptr
 
TStyle * s_ = nullptr
 
std::unordered_map< std::string, std::vector< TGraph * > > id_tgraphs_map_
 

Detailed Description

This class simplifies the creation of line graphs using data from TimeSeries.

Definition at line 36 of file line_graph.h.

Constructor & Destructor Documentation

◆ LineGraph()

bdm::experimental::LineGraph::LineGraph ( const TimeSeries ts,
const std::string &  title = "",
const std::string &  xaxis_title = "",
const std::string &  yaxis_title = "",
bool  legend = true,
TStyle *  style = nullptr,
int  width = 700,
int  height = 500 
)
Parameters
styleThis class does not take ownership of style

Definition at line 31 of file line_graph.cc.

◆ ~LineGraph()

bdm::experimental::LineGraph::~LineGraph ( )

Definition at line 50 of file line_graph.cc.

Member Function Documentation

◆ Add()

TGraph * bdm::experimental::LineGraph::Add ( const std::string &  ts_name,
const std::string &  legend_name = "",
const char *  add_mg_options = "L",
short  line_color = 1,
float  line_color_alpha = 1.0,
short  line_style = 1,
short  line_width = 1,
short  marker_color = 1,
float  marker_color_alpha = 1.0,
short  marker_style = 1,
float  marker_size = 1,
short  fill_color = 0,
float  fill_color_alpha = 1.0,
short  fill_style = 1000 
)

Add a new graph to the plot The following links provide further information for line, marker, and fill parameters:

See also
https://root.cern/doc/master/classTAttLine.html
https://root.cern/doc/master/classTAttMarker.html
https://root.cern/doc/master/classTAttFill.html

Definition at line 59 of file line_graph.cc.

◆ Draw()

void bdm::experimental::LineGraph::Draw ( const char *  canvas_draw_option = "")

Definition at line 109 of file line_graph.cc.

◆ GetTCanvas()

TCanvas * bdm::experimental::LineGraph::GetTCanvas ( )

Definition at line 161 of file line_graph.cc.

◆ GetTGraphs()

const std::vector< TGraph * > & bdm::experimental::LineGraph::GetTGraphs ( const std::string &  ts_name) const

Definition at line 170 of file line_graph.cc.

◆ GetTLegend()

TLegend * bdm::experimental::LineGraph::GetTLegend ( )

Definition at line 167 of file line_graph.cc.

◆ GetTMultiGraph()

TMultiGraph * bdm::experimental::LineGraph::GetTMultiGraph ( )

Definition at line 164 of file line_graph.cc.

◆ GetTStyle()

TStyle * bdm::experimental::LineGraph::GetTStyle ( )

Definition at line 181 of file line_graph.cc.

◆ SaveAs()

void bdm::experimental::LineGraph::SaveAs ( const std::string &  filenpath_wo_extension,
const std::vector< std::string > &  extensions 
)

Definition at line 145 of file line_graph.cc.

◆ SetLegendPos()

void bdm::experimental::LineGraph::SetLegendPos ( real_t  x1,
real_t  y1,
real_t  x2,
real_t  y2 
)

Definition at line 115 of file line_graph.cc.

◆ SetLegendPosNDC()

void bdm::experimental::LineGraph::SetLegendPosNDC ( real_t  x1,
real_t  y1,
real_t  x2,
real_t  y2 
)

NDC coordinates are a % of the canvas size: (0.5,0.5) is the middle of the canvas. (1,1) upper right corner, (0,0) bottom left corner. https://root-forum.cern.ch/t/how-to-imagine-ndc-normalized-coord/24202

Definition at line 130 of file line_graph.cc.

◆ SetMultiGraphDrawOption()

void bdm::experimental::LineGraph::SetMultiGraphDrawOption ( const std::string &  s)

Definition at line 156 of file line_graph.cc.

◆ Update()

void bdm::experimental::LineGraph::Update ( )

Definition at line 184 of file line_graph.cc.

Member Data Documentation

◆ c_

TCanvas* bdm::experimental::LineGraph::c_ = nullptr
private

Definition at line 85 of file line_graph.h.

◆ id_tgraphs_map_

std::unordered_map<std::string, std::vector<TGraph*> > bdm::experimental::LineGraph::id_tgraphs_map_
private

Definition at line 89 of file line_graph.h.

◆ l_

TLegend* bdm::experimental::LineGraph::l_ = nullptr
private

Definition at line 87 of file line_graph.h.

◆ mg_

TMultiGraph* bdm::experimental::LineGraph::mg_ = nullptr
private

Definition at line 86 of file line_graph.h.

◆ mg_draw_option_

std::string bdm::experimental::LineGraph::mg_draw_option_ = "A"
private

Definition at line 84 of file line_graph.h.

◆ s_

TStyle* bdm::experimental::LineGraph::s_ = nullptr
private

Definition at line 88 of file line_graph.h.

◆ ts_

const TimeSeries* bdm::experimental::LineGraph::ts_ = nullptr
private

Definition at line 83 of file line_graph.h.


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