YATiSh
Yet Another TIme SHeet
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
yatishPlot Class Referenceabstract

Abstract Base class for the plots of panel #3. More...

#include <yatishPlot.h>

Public Member Functions

 yatishPlot (yatishDBsqlite *)
 The constructor of yatishPlot: More...
 
virtual ~yatishPlot ()
 
void SetFirstDay (const wxDateTime &dt)
 
void SetLastDay (const wxDateTime &dt)
 
virtual void PlotData (ClusterType, AggregateType)=0
 Plotting interface for yatishFrame: More...
 
virtual wxString TotalFormatted ()
 

Protected Member Functions

void GetWeekRange (unsigned int &, unsigned int &)
 Computes the week numbers corresponding to members firstDay and lastDay. More...
 
void ComputePie (ClusterType)
 Fills member pieData with data for a pie chart with 4 sectors. More...
 
wxString TotalFormattedFromPie ()
 Creates a wxString with the total hours in the current pie chart. More...
 
bool SelectData (ClusterType, AggregateType)
 Updates vector_Y[3] if need be (for the plotting libraries). More...
 
virtual void SetRangeX ()
 
virtual void ClearCurves ()
 

Protected Attributes

Map4pie pieData
 total durations (between firstDay and lastDay), in minutes More...
 
wxDateTime firstDay
 
wxDateTime lastDay
 
AggregateType formerAggregate
 

Static Protected Attributes

static ProcessedData data
 weekly times series: various aggregates and clustered sums More...
 
static string legends [3]
 names of the 3 weekly clustered sums, for the current clustering scheme More...
 
static vector< double > vector_X
 epoch time More...
 
static vector< double > vector_X2
 week number, counted from the first year in the time series More...
 
static vector< double > vector_Y [3]
 user selected data More...
 

Private Member Functions

void Aggregates ()
 Builds all the weekly time series (non-clustered aggregates). More...
 
void NoMoreThan4 ()
 Modifies member pieData so that there is no more than four record. More...
 
void ClusteredSeries (ClusterType)
 Updates the clustered time series. More...
 

Static Private Attributes

static bool data_loaded = false
 
static RawData big_data
 all timeslot records from the database More...
 

Detailed Description

Abstract Base class for the plots of panel #3.

The times series are compiled on a weekly basis.

They are either "aggregated" (only one curve is shown at any time):

or "clustered" (the 3 most significant curves are shown):

and in the latter case the relevant aggregate is "hours (total)" [per week].

Definition at line 34 of file yatishPlot.h.

Constructor & Destructor Documentation

◆ yatishPlot()

yatishPlot::yatishPlot ( yatishDBsqlite pdb)

The constructor of yatishPlot:

  • gets its RawData from yatishDBsqlite;
  • computes the various aggregates.
Note
RawData are not updated during a given YATiSh run.

Definition at line 36 of file yatishPlot.cpp.

◆ ~yatishPlot()

virtual yatishPlot::~yatishPlot ( )
inlinevirtual

Definition at line 37 of file yatishPlot.h.

Member Function Documentation

◆ Aggregates()

void yatishPlot::Aggregates ( )
private

Builds all the weekly time series (non-clustered aggregates).

Note
Local variable big_data was ordered by increasing Record.start thanks to yatishDBsqlite::FillPlotData(). No time window here.

Definition at line 90 of file yatishPlot.cpp.

◆ ClearCurves()

virtual void yatishPlot::ClearCurves ( )
inlineprotectedvirtual

Reimplemented in yatishFreeSerie, and yatishMathPlot.

Definition at line 68 of file yatishPlot.h.

◆ ClusteredSeries()

void yatishPlot::ClusteredSeries ( ClusterType  clusters)
private

Updates the clustered time series.

No time filtering here, but the curves are selected according to Pies() which does take the date range into account.

Note
The time axis (weekCenter) is already there thanks to Aggregates() which was called by the constructor.

Definition at line 238 of file yatishPlot.cpp.

◆ ComputePie()

void yatishPlot::ComputePie ( ClusterType  clusters)
protected

Fills member pieData with data for a pie chart with 4 sectors.

Only the records between firstday and lastDay are considered.

Parameters
[in]clustersany value except none
Note
Also used by ClusteredSeries(), to choose the 3 most significant time series and get their legend.

Definition at line 152 of file yatishPlot.cpp.

◆ GetWeekRange()

void yatishPlot::GetWeekRange ( unsigned int &  firstWeek,
unsigned int &  lastWeek 
)
protected

Computes the week numbers corresponding to members firstDay and lastDay.

Parameters
[in,out]firstWeekweek number corresponding to the current value of firstDay
[in,out]lastWeekweek number corresponding to the current value of lastDay
Note
The algorithm is consistent with the one used by yatishPlot() for member vector_X2.

Definition at line 64 of file yatishPlot.cpp.

◆ NoMoreThan4()

void yatishPlot::NoMoreThan4 ( )
private

Modifies member pieData so that there is no more than four record.

Creates or rename an others key, which contains the smallest item(s).

Definition at line 194 of file yatishPlot.cpp.

◆ PlotData()

virtual void yatishPlot::PlotData ( ClusterType  ,
AggregateType   
)
pure virtual

Plotting interface for yatishFrame:

  • computes data that depends on the time window;
  • updates the plot selected by the user (in controls of panel #3).
Parameters
[in]clustersthe clusters to compute and show; default: none
[in]aggregateif clusters are not used, the aggregate to show; default: hoursTotal
Note
PlotData() is supposed to be called when something has changed (at least the time window).
Todo:

runtime instability when clusters == tools or when switching back from pie chart (debug mode), although no problem was debugger detected in ComputePie() nor ClusteredSeries()

default plot (timeSeries/hoursTotal/none) sometimes empty when changing library in settings (need to play with aggregate choice to recover it)

Implemented in yatishChartPie, yatishChartSerie, yatishFreePie, yatishFreeSerie, and yatishMathPlot.

◆ SelectData()

bool yatishPlot::SelectData ( ClusterType  clusters,
AggregateType  aggregate 
)
protected

Updates vector_Y[3] if need be (for the plotting libraries).

Returns
true if nothing else to be done (false if replot is needed)
Note
calls virtual methods SetRangeX() and ClearCurves()

Definition at line 283 of file yatishPlot.cpp.

◆ SetFirstDay()

void yatishPlot::SetFirstDay ( const wxDateTime &  dt)
inline

Definition at line 38 of file yatishPlot.h.

◆ SetLastDay()

void yatishPlot::SetLastDay ( const wxDateTime &  dt)
inline

Definition at line 39 of file yatishPlot.h.

◆ SetRangeX()

virtual void yatishPlot::SetRangeX ( )
inlineprotectedvirtual

Reimplemented in yatishChartSerie, yatishFreeSerie, and yatishMathPlot.

Definition at line 67 of file yatishPlot.h.

◆ TotalFormatted()

virtual wxString yatishPlot::TotalFormatted ( )
inlinevirtual

Reimplemented in yatishChartPie, and yatishFreePie.

Definition at line 53 of file yatishPlot.h.

◆ TotalFormattedFromPie()

wxString yatishPlot::TotalFormattedFromPie ( )
protected

Creates a wxString with the total hours in the current pie chart.

To be used by derived classes willing to overload the default TotalFormatted() [which returns a wxEmptyString].

Definition at line 225 of file yatishPlot.cpp.

Member Data Documentation

◆ big_data

RawData yatishPlot::big_data
staticprivate

all timeslot records from the database

Definition at line 71 of file yatishPlot.h.

◆ data

ProcessedData yatishPlot::data
staticprotected

weekly times series: various aggregates and clustered sums

Definition at line 55 of file yatishPlot.h.

◆ data_loaded

bool yatishPlot::data_loaded = false
staticprivate

Definition at line 70 of file yatishPlot.h.

◆ firstDay

wxDateTime yatishPlot::firstDay
protected

Definition at line 61 of file yatishPlot.h.

◆ formerAggregate

AggregateType yatishPlot::formerAggregate
protected

Definition at line 62 of file yatishPlot.h.

◆ lastDay

wxDateTime yatishPlot::lastDay
protected

Definition at line 61 of file yatishPlot.h.

◆ legends

string yatishPlot::legends
staticprotected

names of the 3 weekly clustered sums, for the current clustering scheme

Definition at line 56 of file yatishPlot.h.

◆ pieData

Map4pie yatishPlot::pieData
protected

total durations (between firstDay and lastDay), in minutes

Definition at line 60 of file yatishPlot.h.

◆ vector_X

vector< double > yatishPlot::vector_X
staticprotected

epoch time

Definition at line 57 of file yatishPlot.h.

◆ vector_X2

vector< double > yatishPlot::vector_X2
staticprotected

week number, counted from the first year in the time series

Definition at line 58 of file yatishPlot.h.

◆ vector_Y

vector< double > yatishPlot::vector_Y
staticprotected

user selected data

Definition at line 59 of file yatishPlot.h.


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