14#include "gnuplot-iostream.h"
27 std::vector<std::string>
30 static std::string csv_column_name;
31 static int csv_column;
32 static float time_in_weeks;
45 Plot(std::string s,
float time);
63 void display(std::string
const &s)
const;
97 std::string
const &file_name,
113 void create_temp_file(std::string
const &data, std::string
const &file_name);
Wraps gnuplot to plot stock data.
Definition plot.h:25
~Plot()
Destructor cleans up temporaray files storing stock data.
Definition plot.cpp:155
void display() const
Plot data for all stocks.
Definition plot.cpp:120
void percentage_plot(Gnuplot &g, std::string const &file_name, const Plot_type type) const
Plot data from time_in_weeks up until today. Oldest datapoint is normalized for all stocks.
Definition plot.cpp:89
void set_function(std::string const &function)
Set to daily / weekly / monthly data.
Definition plot.cpp:150
static float get_time_in_weeks()
Getter.
Definition plot.cpp:29
void setup_gnuplot(Gnuplot &g) const
Setup options for gnuplot.
Definition plot.cpp:65
void get_first_datapoint(Gnuplot &g, std::string const &file_name) const
Calculate furthest point back in time upto which to plot (time_in_weeks). The point is saved in a var...
Definition plot.cpp:78
void process_data(std::string &s) const
Figure out which column to plot, comment out first row for gnuplot and remove all carriage returns.
Definition plot.cpp:35
void cleanup() const
Delete files storing stock data.
Definition plot.cpp:141
void create_temp_file(std::string const &data, std::string const &file_name)
Create a file to store stock data. Will be deleted at end of program.
Definition plot.cpp:52
Plot()
Default constructor.
Definition plot.cpp:20
Plot_type
Definition plot.cpp:11