QtiPlot  0.9.8.2
Public Types | Public Slots | Public Member Functions | Private Slots | Private Attributes | List of all members
TableStatistics Class Reference

Table that computes and displays statistics on another Table. More...

#include <TableStatistics.h>

Inheritance diagram for TableStatistics:
Table MdiSubWindow scripted

Public Types

enum  StatisticsColType {
  NoStats, Row, Col, Rows,
  Cols, Mean, StandardDev, StandardError,
  Variance, Sum, iMax, Max,
  iMin, Min, N, Median
}
 
enum  Type { row, column }
 supported statistics types More...
 
- Public Types inherited from Table
enum  ColType {
  Numeric = 0, Text = 1, Date = 2, Time = 3,
  Month = 4, Day = 5
}
 
enum  ImportMode { NewColumns, NewRows, Overwrite }
 
enum  NumericFormat { Default = 0, Decimal = 1, Scientific = 2 }
 
enum  PlotDesignation {
  All = -1, None = 0, X = 1, Y = 2,
  Z = 3, xErr = 4, yErr = 5, Label = 6
}
 
- Public Types inherited from MdiSubWindow
enum  CaptionPolicy { Name = 0, Label = 1, Both = 2 }
 Possible window captions. More...
 
enum  Status { Hidden = -1, Normal = 0, Minimized = 1, Maximized = 2 }
 

Public Slots

void removeCol (const QString &)
 remove statistics of removed columns (to be connected with Table::removedCol) More...
 
void renameCol (const QString &, const QString &)
 handle renaming of columns (to be connected with Table::changedColHeader) More...
 
void update ()
 update statistics when the user triggers a recaculate action More...
 
void update (Table *, const QString &colName)
 update statistics after a column has changed (to be connected with Table::modifiedData) More...
 
- Public Slots inherited from Table
MyTabletable ()
 
- Public Slots inherited from MdiSubWindow

Public Member Functions

Tablebase () const
 return the base table of which statistics are displayed More...
 
QString baseName ()
 
virtual void save (const QString &, const QString &geometry, bool=false)
 
void setBase (Table *t)
 
void setBaseName (const QString &name)
 
void setColumnStatsTypes (const QList< int > &colStatTypes)
 
void setRange (int start, int end)
 
 TableStatistics (ScriptingEnv *env, ApplicationWindow *parent, Table *base, Type, QList< int > targets, int start=0, int end=-1)
 
Type type () const
 return the type of statistics More...
 
- Public Member Functions inherited from Table
void adjustColumnsWidth (bool selection=true)
 
double avg (int col, int startRow=0, int endRow=-1)
 
bool calculate (int col, int startRow, int endRow, bool forceMuParser=false, bool notifyChanges=true)
 Compute specified cells from column formula. More...
 
bool calculate ()
 Compute selected cells from column formulae; use current cell if there's no selection. More...
 
double cell (int row, int col)
 Return the value of the cell as a double. More...
 
void cellEdited (int, int col)
 
void clearCell (int row, int col)
 
void clearCommands ()
 Clear all column formulae. More...
 
QVarLengthArray< double > col (int ycol)
 
int colIndex (const QString &name)
 
QString colLabel (int col)
 
QString colName (int col)
 
QStringList colNames ()
 
int colPlotDesignation (int col)
 
QString columnFormat (int col)
 
void columnNumericFormat (int col, char *f, int *precision)
 
void columnNumericFormat (int col, int *f, int *precision)
 
void columnRange (int c, double *min, double *max)
 
QStringList columnsList ()
 
int columnType (int col)
 
QList< int > columnTypes ()
 
int columnWidth (int col)
 
QStringList columnWidths ()
 
int colX (int col)
 
int colY (int col, int xCol=-1, const QStringList &lst=QStringList())
 
void copy (Table *m, bool values=true)
 
QStringList drawableColumnSelection ()
 
bool exportASCII (const QString &fname, const QString &separator, bool withLabels=false, bool exportComments=false, bool exportSelection=false)
 
bool exportExcel (const QString &fname, bool withLabels, bool exportComments, bool exportSelection)
 
bool exportODF (const QString &fname, bool withLabels, bool exportComments, bool exportSelection)
 
bool exportOdsSpreadsheet (const QString &fname, bool withLabels, bool exportComments, bool exportSelection)
 
void exportPDF (const QString &fileName)
 
TableextractData (const QString &name, const QString &condition, int startRow=0, int endRow=-1)
 
int firstSelectedColumn ()
 
int firstXCol ()
 
void freeMemory ()
 
QStringList getColumnsFormat ()
 
QStringList getCommands ()
 
Q3TableSelection getSelection ()
 
void goToColumn (int col)
 Scroll to column (column starts with 1) More...
 
void goToRow (int row)
 Scroll to row (row starts with 1) More...
 
void importASCII (const QString &fname, const QString &sep="\, int ignoredLines=0, bool renameCols=false, bool stripSpaces=false, bool simplifySpaces=false, bool importComments=false, const QString &commentString="", bool readOnly=false, ImportMode importAs=Overwrite, const QLocale &importLocale=QLocale(), int endLine=0, int maxRows=-1, const QList< int > &newColTypes=QList< int >(), const QStringList &colFormats=QStringList())
 
void init (int rows, int cols)
 
bool isColumnSelected (int col, bool full=false)
 
bool isEmptyColumn (int col)
 
bool isEmptyRow (int row)
 
bool isReadOnlyColumn (int col)
 
bool isRowSelected (int row, bool full=false)
 
void loadHeader (QStringList header)
 
double maxColumnValue (int col, int startRow=0, int endRow=-1)
 
double minColumnValue (int col, int startRow=0, int endRow=-1)
 
void moveCurrentCell ()
 
bool muParserCalculate (int col, int startRow, int endRow, bool notifyChanges=true)
 Compute specified cells from column formula (optimized for muParser). More...
 
int nonEmptyRows ()
 
bool noXColumn ()
 
bool noYColumn ()
 
int numCols ()
 
int numRows ()
 
int numSelectedRows ()
 
QList< int > plotDesignations ()
 
void print ()
 
void print (QPrinter *)
 
void print (const QString &fileName)
 
void resizeCols (int)
 
void resizeRows (int)
 
void saveToMemory (double **cells)
 
void saveToMemory ()
 
int selectedColsNumber ()
 
int selectedColumn ()
 
QStringList selectedColumns ()
 
QStringList selectedErrColumns ()
 
QStringList selectedYColumns ()
 
QStringList selectedYLabels ()
 
void setAscValues ()
 
void setAutoUpdateValues (bool on=true)
 
void setCell (int row, int col, double val)
 
void setColName (int col, const QString &text, bool enumerateRight=false, bool warn=true)
 
void setColNumericFormat (int col)
 
void setColNumericFormat (int f, int prec, int col, bool updateCells=true)
 
void setColPlotDesignation (int col, PlotDesignation pd)
 
void setColumnsFormat (const QStringList &lst)
 
void setColumnType (int col, ColType val)
 
void setColumnTypes (QList< int > ctl)
 
void setColumnTypes (const QStringList &ctl)
 
void setColumnWidth (int width, bool allCols)
 
void setColumnWidth (int col, int width)
 
void setColWidths (const QStringList &widths)
 
void setCommand (int col, const QString &com)
 Set formula for column col. More...
 
void setCommands (const QStringList &com)
 Set all column formulae. More...
 
void setCommands (const QString &com)
 Set all column formulae. More...
 
bool setDateFormat (const QString &format, int col, bool updateCells=true)
 
void setDayFormat (const QString &format, int col, bool updateCells=true)
 
void setHeader (QStringList header)
 
void setHeaderColType ()
 
void setMonthFormat (const QString &format, int col, bool updateCells=true)
 
void setNormalRandomValues ()
 
void setNormalRandomValues (int col, int startRow=0, int endRow=-1, double sigma=1.0)
 
void setNumCols (int cols)
 
void setNumericPrecision (int prec)
 Sets the number of significant digits. More...
 
void setNumRows (int rows)
 
void setPlotDesignation (PlotDesignation pd, bool rightColumns=false)
 
void setRandomValues ()
 
void setRandomValues (int col, int startRow=0, int endRow=-1)
 
void setReadOnlyColumn (int col, bool on=true)
 
void setSelectedCol (int col)
 
void setText (int row, int col, const QString &text)
 
void setTextFormat (int col)
 
bool setTimeFormat (const QString &format, int col, bool updateCells=true)
 
virtual QString sizeToString ()
 Size of the widget as a string. More...
 
double sum (int col, int startRow=0, int endRow=-1)
 
 Table (ScriptingEnv *env, int r, int c, const QString &label, ApplicationWindow *parent, const QString &name=QString(), Qt::WFlags f=0)
 
QString text (int row, int col)
 
void updateDecimalSeparators (const QLocale &oldSeparators)
 Updates the decimal separators when importing ASCII files on user request. More...
 
void updateValues (Table *, const QString &columnName)
 Recalculates values in all columns with formulas containing. More...
 
QStringList writableSelectedColumns ()
 
QStringList YColumns ()
 
bool eventFilter (QObject *object, QEvent *e)
 
void customEvent (QEvent *e)
 
void removeCol ()
 
void removeCol (const QStringList &list)
 
void insertCol ()
 
virtual void insertCols (int start, int count)
 
virtual void addCol (PlotDesignation pd=Y)
 
void addColumns (int c)
 
virtual void moveColumn (int, int, int)
 
void swapColumns (int, int)
 
void moveColumnBy (int cols)
 
void hideSelectedColumns ()
 
void showAllColumns ()
 
void hideColumn (int col, bool=true)
 
bool isColumnHidden (int col)
 
void sortColAsc ()
 Sort the current column in ascending order. More...
 
void sortColDesc ()
 Sort the current column in descending order. More...
 
void sortColumn (int col=-1, int order=0)
 Sort the specified column. More...
 
void sortTableDialog ()
 Display a dialog with some options for sorting all columns. More...
 
void sort (int type=0, int order=0, const QString &leadCol=QString())
 Sort all columns as in sortColumns(const QStringList&,int,int,const QString&). More...
 
void sortColumns (int type=0, int order=0, const QString &leadCol=QString())
 Sort selected columns as in sortColumns(const QStringList&,int,int,const QString&). More...
 
void sortColumns (const QStringList &cols, int type=0, int order=0, const QString &leadCol=QString())
 Sort the specified columns. More...
 
void sortColumnsDialog ()
 Display a dialog with some options for sorting the selected columns. More...
 
void normalizeCol (int col=-1)
 
void normalizeSelection ()
 
void normalize ()
 
void deleteSelectedRows ()
 
void deleteRows (int startRow, int endRow)
 
void insertRow ()
 
void moveRow (bool up=true)
 
void cutSelection ()
 Selection Operations. More...
 
void copySelection ()
 
void clearSelection ()
 
void pasteSelection ()
 
void selectAllTable ()
 
void deselect ()
 
void clear ()
 
void restore (const QStringList &lst)
 Not implemented yet. More...
 
QString saveHeader ()
 
QString saveComments ()
 
QString saveCommands ()
 
QString saveColumnWidths ()
 
QString saveColumnTypes ()
 
QString saveReadOnlyInfo ()
 
QString saveHiddenColumnsInfo ()
 
void setBackgroundColor (const QColor &col)
 
void setTextColor (const QColor &col)
 
void setHeaderColor (const QColor &col)
 
void setTextFont (const QFont &fnt)
 
void setHeaderFont (const QFont &fnt)
 
int verticalHeaderWidth ()
 
QString comment (int col)
 
void setColComment (int col, const QString &s)
 
QStringList colComments ()
 
void setColComments (const QStringList &lst)
 
void showComments (bool on=true)
 
bool commentsEnabled ()
 
void notifyChanges ()
 This slot notifies the main application that the table has been modified. Triggers the update of 2D plots. More...
 
void notifyChanges (const QString &colName)
 
void colWidthModified (int, int, int)
 Notifies the main application that the width of a table column has been modified by the user. More...
 
- Public Member Functions inherited from MdiSubWindow
ApplicationWindowapplicationWindow ()
 Returns a pointer to the parent application. More...
 
void askOnCloseEvent (bool ask)
 Toggle the "ask on close" flag. More...
 
QString aspect ()
 Return the window status as a string. More...
 
QString birthDate ()
 Return the creation date. More...
 
CaptionPolicy captionPolicy ()
 Return the caption policy. More...
 
void closeEvent (QCloseEvent *)
 Close event handler. More...
 
bool eventFilter (QObject *object, QEvent *e)
 Filters other object's events (customizes title bar's context menu) More...
 
Folderfolder ()
 Returns the pointer to the parent folder of the window. More...
 
 MdiSubWindow (const QString &label=QString(), ApplicationWindow *app=0, const QString &name=QString(), Qt::WFlags f=0)
 Constructor. More...
 
QSize minRestoreSize ()
 Returns the size the window had before a change state event to minimized. More...
 
QString name ()
 Return the window name. More...
 
void notifyChanges ()
 Notifies the main application that the window has been modified. More...
 
void resizeEvent (QResizeEvent *)
 
void restoreWindow ()
 Show window making sure that layers in MultiLayer windows are not resized. More...
 
void setBirthDate (const QString &s)
 Set the creation date. More...
 
void setCaptionPolicy (CaptionPolicy policy)
 Set the caption policy. More...
 
void setFolder (Folder *f)
 Initializes the pointer to the parent folder of the window. More...
 
virtual void setHidden ()
 Notifies that a window was hidden by a direct user action. More...
 
void setMaximized ()
 
void setMinimized ()
 
void setName (const QString &s)
 Set the window name. More...
 
void setNormal ()
 
void setStatus (Status s)
 Set the window status flag (hidden, normal, minimized or maximized) More...
 
void setWindowLabel (const QString &s)
 Set the window label. More...
 
Status status ()
 Return the window status flag (hidden, normal, minimized or maximized) More...
 
QString windowLabel ()
 Return the window label. More...
 
- Public Member Functions inherited from scripted
 scripted (ScriptingEnv *env)
 
void scriptingChangeEvent (ScriptingChangeEvent *)
 
ScriptingEnvscriptingEnv ()
 
 ~scripted ()
 

Private Slots

void addCol (PlotDesignation pd=Y)
 
void changeColIndex (int, int)
 
void closedBase ()
 
void insertCols (int start, int count)
 
void moveColumn (int, int, int)
 
void removeStatsCol (int)
 

Private Attributes

Tabled_base
 
QString d_base_name
 
int d_end
 
int d_start
 
QList< int > d_stats_col_type
 
QList< int > d_targets
 
Type d_type
 

Additional Inherited Members

- Signals inherited from Table
void changedColHeader (const QString &, const QString &)
 
void removedCol (const QString &)
 
void addedCol (const QString &)
 
void removedCol (int)
 
void colIndexChanged (int, int)
 
void modifiedData (Table *, const QString &)
 
void optionsDialog ()
 
void colValuesDialog ()
 
void resizedTable (QWidget *)
 
void showContextMenu (bool selection)
 
- Signals inherited from MdiSubWindow
void closedWindow (MdiSubWindow *)
 Emitted when the window was closed. More...
 
void hiddenWindow (MdiSubWindow *)
 Emitted when the window was hidden. More...
 
void modifiedWindow (MdiSubWindow *)
 
void resizedWindow (MdiSubWindow *)
 
void showContextMenu ()
 Show the context menu. More...
 
void statusChanged (MdiSubWindow *)
 Emitted when the window status changed. More...
 
- Static Public Member Functions inherited from Table
static QDateTime dateTime (double val)
 
static double fromDateTime (const QDateTime &dt)
 
static double fromTime (const QTime &t)
 
- Static Public Member Functions inherited from MdiSubWindow
static QString parseAsciiFile (const QString &fname, const QString &commentString, int endLine, int ignoreFirstLines, int maxRows, int &rows)
 Static function used as a workaround for ASCII files having end line char != '
'. More...
 
- Protected Member Functions inherited from MdiSubWindow
virtual void changeEvent (QEvent *event)
 Catches status changes. More...
 
- Protected Attributes inherited from Table
MyTabled_table
 
- Protected Attributes inherited from scripted
ScriptingEnvscriptEnv
 

Detailed Description

Table that computes and displays statistics on another Table.

Future Plans

Make it possible to add new columns/rows to be monitored.

Member Enumeration Documentation

§ StatisticsColType

Enumerator
NoStats 
Row 
Col 
Rows 
Cols 
Mean 
StandardDev 
StandardError 
Variance 
Sum 
iMax 
Max 
iMin 
Min 
Median 

§ Type

supported statistics types

Enumerator
row 
column 

Constructor & Destructor Documentation

§ TableStatistics()

TableStatistics::TableStatistics ( ScriptingEnv env,
ApplicationWindow parent,
Table base,
Type  t,
QList< int >  targets,
int  start = 0,
int  end = -1 
)

Member Function Documentation

§ addCol

void TableStatistics::addCol ( PlotDesignation  pd = Y)
privateslot

References Table::addCol(), d_stats_col_type, and NoStats.

Referenced by setBaseName().

§ base()

Table* TableStatistics::base ( ) const
inline

return the base table of which statistics are displayed

References d_base, save(), setBase(), setColumnStatsTypes(), and setRange().

§ baseName()

QString TableStatistics::baseName ( )
inline

References d_base_name.

Referenced by ApplicationWindow::openProject().

§ changeColIndex

void TableStatistics::changeColIndex ( int  fromIndex,
int  toIndex 
)
privateslot

References d_stats_col_type.

Referenced by setBaseName(), and TableStatistics().

§ closedBase

void TableStatistics::closedBase ( )
privateslot

References d_base.

Referenced by setBase(), and setBaseName().

§ insertCols

void TableStatistics::insertCols ( int  start,
int  count 
)
privateslot

References d_stats_col_type, Table::insertCols(), and NoStats.

Referenced by setBaseName().

§ moveColumn

void TableStatistics::moveColumn ( int  ,
int  fromIndex,
int  toIndex 
)
privateslot

References d_stats_col_type, and Table::moveColumn().

Referenced by setBaseName().

§ removeCol

void TableStatistics::removeCol ( const QString &  col)
slot

remove statistics of removed columns (to be connected with Table::removedCol)

References d_base, Table::d_table, d_targets, d_type, row, Table::text(), and update().

§ removeStatsCol

void TableStatistics::removeStatsCol ( int  col)
privateslot

References d_stats_col_type.

Referenced by setBaseName(), and TableStatistics().

§ renameCol

void TableStatistics::renameCol ( const QString &  from,
const QString &  to 
)
slot

handle renaming of columns (to be connected with Table::changedColHeader)

References d_base, d_targets, d_type, row, Table::setText(), and Table::text().

Referenced by setBase(), and setBaseName().

§ save()

void TableStatistics::save ( const QString &  fn,
const QString &  geometry,
bool  = false 
)
virtual

§ setBase()

void TableStatistics::setBase ( Table t)

§ setBaseName()

void TableStatistics::setBaseName ( const QString &  name)
inline

§ setColumnStatsTypes()

void TableStatistics::setColumnStatsTypes ( const QList< int > &  colStatTypes)

§ setRange()

void TableStatistics::setRange ( int  start,
int  end 
)

References d_end, and d_start.

Referenced by base(), and ApplicationWindow::openTableStatistics().

§ type()

Type TableStatistics::type ( ) const
inline

return the type of statistics

References d_type.

§ update [1/2]

void TableStatistics::update ( )
slot

update statistics when the user triggers a recaculate action

References Table::colName(), d_base, and Table::numCols().

Referenced by removeCol(), setBase(), and setBaseName().

§ update [2/2]

void TableStatistics::update ( Table t,
const QString &  colName 
)
slot

Member Data Documentation

§ d_base

Table* TableStatistics::d_base
private

§ d_base_name

QString TableStatistics::d_base_name
private

Referenced by baseName(), setBase(), and setBaseName().

§ d_end

int TableStatistics::d_end
private

Referenced by save(), setBase(), setRange(), and update().

§ d_start

int TableStatistics::d_start
private

§ d_stats_col_type

QList<int> TableStatistics::d_stats_col_type
private

§ d_targets

QList<int> TableStatistics::d_targets
private

§ d_type

Type TableStatistics::d_type
private

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