QtiPlot  0.9.8.2
Public Types | Public Slots | Public Member Functions | Private Slots | Private Attributes
TableStatistics Class Reference

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

#include <TableStatistics.h>

Inheritance diagram for TableStatistics:
Table MdiSubWindow scripted

List of all members.

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)
void renameCol (const QString &, const QString &)
 handle renaming of columns (to be connected with Table::changedColHeader)
void update ()
 update statistics when the user triggers a recaculate action
void update (Table *, const QString &colName)
 update statistics after a column has changed (to be connected with Table::modifiedData)
- Public Slots inherited from Table
void adjustColumnsWidth (bool selection=true)
bool calculate (int col, int startRow, int endRow, bool forceMuParser=false, bool notifyChanges=true)
 Compute specified cells from column formula.
bool calculate ()
 Compute selected cells from column formulae; use current cell if there's no selection.
double cell (int row, int col)
 Return the value of the cell as a double.
void cellEdited (int, int col)
void clearCell (int row, int col)
void clearCommands ()
 Clear all column formulae.
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)
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)
int firstSelectedColumn ()
int firstXCol ()
void freeMemory ()
QStringList getColumnsFormat ()
QStringList getCommands ()
void goToColumn (int col)
 Scroll to column (column starts with 1)
void goToRow (int row)
 Scroll to row (row starts with 1)
void importASCII (const QString &fname, const QString &sep="\t", 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)
void moveCurrentCell ()
bool muParserCalculate (int col, int startRow, int endRow, bool notifyChanges=true)
 Compute specified cells from column formula (optimized for muParser).
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 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.
void setCommands (const QStringList &com)
 Set all column formulae.
void setCommands (const QString &com)
 Set all column formulae.
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 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)
MyTabletable ()
QString text (int row, int col)
void updateValues (Table *, const QString &columnName)
 Recalculates values in all columns with formulas containing.
QStringList writableSelectedColumns ()
QStringList YColumns ()
bool eventFilter (QObject *object, QEvent *e)
 Filters other object's events (customizes title bar's context menu)
void customEvent (QEvent *e)
void removeCol ()
void removeCol (const QStringList &list)
void insertCol ()
void addColumns (int c)
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.
void sortColDesc ()
 Sort the current column in descending order.
void sortColumn (int col=-1, int order=0)
 Sort the specified column.
void sortTableDialog ()
 Display a dialog with some options for sorting all columns.
void sort (int type=0, int order=0, const QString &leadCol=QString())
 Sort all columns as in sortColumns(const QStringList&,int,int,const QString&).
void sortColumns (int type=0, int order=0, const QString &leadCol=QString())
 Sort selected columns as in sortColumns(const QStringList&,int,int,const QString&).
void sortColumns (const QStringList &cols, int type=0, int order=0, const QString &leadCol=QString())
 Sort the specified columns.
void sortColumnsDialog ()
 Display a dialog with some options for sorting the selected columns.
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.
void copySelection ()
void clearSelection ()
void pasteSelection ()
void selectAllTable ()
void deselect ()
void clear ()
void restore (const QStringList &lst)
 Not implemented yet.
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.
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.
- Public Slots inherited from MdiSubWindow

Public Member Functions

Tablebase () const
 return the base table of which statistics are displayed
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
- Public Member Functions inherited from Table
double avg (int col, int startRow=0, int endRow=-1)
TableextractData (const QString &name, const QString &condition, int startRow=0, int endRow=-1)
Q3TableSelection getSelection ()
double maxColumnValue (int col, int startRow=0, int endRow=-1)
double minColumnValue (int col, int startRow=0, int endRow=-1)
void setAutoUpdateValues (bool on=true)
void setNumericPrecision (int prec)
 Sets the number of significant digits.
virtual QString sizeToString ()
 Size of the widget as a string.
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)
void updateDecimalSeparators (const QLocale &oldSeparators)
 Updates the decimal separators when importing ASCII files on user request.
- Public Member Functions inherited from MdiSubWindow
ApplicationWindowapplicationWindow ()
 Returns a pointer to the parent application.
void askOnCloseEvent (bool ask)
 Toggle the "ask on close" flag.
QString aspect ()
 Return the window status as a string.
QString birthDate ()
 Return the creation date.
CaptionPolicy captionPolicy ()
 Return the caption policy.
void closeEvent (QCloseEvent *)
 Close event handler.
Folderfolder ()
 Returns the pointer to the parent folder of the window.
 MdiSubWindow (const QString &label=QString(), ApplicationWindow *app=0, const QString &name=QString(), Qt::WFlags f=0)
 Constructor.
QSize minRestoreSize ()
 Returns the size the window had before a change state event to minimized.
QString name ()
 Return the window name.
void resizeEvent (QResizeEvent *)
void restoreWindow ()
 Show window making sure that layers in MultiLayer windows are not resized.
void setBirthDate (const QString &s)
 Set the creation date.
void setCaptionPolicy (CaptionPolicy policy)
 Set the caption policy.
void setFolder (Folder *f)
 Initializes the pointer to the parent folder of the window.
virtual void setHidden ()
 Notifies that a window was hidden by a direct user action.
void setMaximized ()
void setMinimized ()
void setName (const QString &s)
 Set the window name.
void setNormal ()
void setStatus (Status s)
 Set the window status flag (hidden, normal, minimized or maximized)
void setWindowLabel (const QString &s)
 Set the window label.
Status status ()
 Return the window status flag (hidden, normal, minimized or maximized)
QString windowLabel ()
 Return the window label.
- 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)
- 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 != '
'.
- Protected Attributes inherited from Table
MyTabled_table

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

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

supported statistics types

Enumerator:
row 
column 

Constructor & Destructor Documentation

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

Member Function Documentation

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

Reimplemented from Table.

References d_stats_col_type, and NoStats.

Table* TableStatistics::base ( ) const
inline

return the base table of which statistics are displayed

References d_base.

Referenced by ApplicationWindow::openProject().

QString TableStatistics::baseName ( )
inline

References d_base_name.

Referenced by ApplicationWindow::openProject().

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

References d_stats_col_type.

Referenced by TableStatistics().

void TableStatistics::closedBase ( )
privateslot

References d_base.

Referenced by setBase().

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

Reimplemented from Table.

References d_stats_col_type, and NoStats.

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

Reimplemented from Table.

References d_stats_col_type.

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().

void TableStatistics::removeStatsCol ( int  col)
privateslot

References d_stats_col_type.

Referenced by TableStatistics().

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().

void TableStatistics::save ( const QString &  fn,
const QString &  geometry,
bool  = false 
)
virtual
void TableStatistics::setBase ( Table t)
void TableStatistics::setBaseName ( const QString &  name)
inline
void TableStatistics::setColumnStatsTypes ( const QList< int > &  colStatTypes)
void TableStatistics::setRange ( int  start,
int  end 
)

References d_end, and d_start.

Referenced by ApplicationWindow::openTableStatistics().

Type TableStatistics::type ( ) const
inline

return the type of statistics

References d_type.

void TableStatistics::update ( )
slot

update statistics when the user triggers a recaculate action

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

Referenced by removeCol(), and setBase().

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

Member Data Documentation

Table* TableStatistics::d_base
private
QString TableStatistics::d_base_name
private

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

int TableStatistics::d_end
private

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

int TableStatistics::d_start
private
QList<int> TableStatistics::d_stats_col_type
private
QList<int> TableStatistics::d_targets
private
Type TableStatistics::d_type
private

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