QtiPlot 0.9.8.2
TableStatistics.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : TableStatistics.h
00003     Project              : QtiPlot
00004 --------------------------------------------------------------------
00005     Copyright            : (C) 2006 by Knut Franke
00006     Email (use @ for *)  : knut.franke*gmx.de
00007     Description          : Table subclass that displays statistics on
00008                            columns or rows of another table
00009 
00010  ***************************************************************************/
00011 
00012 /***************************************************************************
00013  *                                                                         *
00014  *  This program is free software; you can redistribute it and/or modify   *
00015  *  it under the terms of the GNU General Public License as published by   *
00016  *  the Free Software Foundation; either version 2 of the License, or      *
00017  *  (at your option) any later version.                                    *
00018  *                                                                         *
00019  *  This program is distributed in the hope that it will be useful,        *
00020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00022  *  GNU General Public License for more details.                           *
00023  *                                                                         *
00024  *   You should have received a copy of the GNU General Public License     *
00025  *   along with this program; if not, write to the Free Software           *
00026  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00027  *   Boston, MA  02110-1301  USA                                           *
00028  *                                                                         *
00029  ***************************************************************************/
00030 #ifndef TABLE_STATISTICS_H
00031 #define TABLE_STATISTICS_H
00032 
00033 #include "Table.h"
00034 
00040 class TableStatistics : public Table
00041 {
00042     Q_OBJECT
00043 
00044     public:
00046         enum Type { row, column };
00047         enum StatisticsColType {NoStats, Row, Col, Rows, Cols, Mean, StandardDev, StandardError, Variance, Sum, iMax, Max, iMin, Min, N, Median};
00048         TableStatistics(ScriptingEnv *env, ApplicationWindow *parent, Table *base, Type, QList<int> targets, int start = 0, int end = -1);
00050         Type type() const { return d_type; }
00052         Table *base() const { return d_base; }
00053         void setBase(Table *t);
00054         // saving
00055         virtual void save(const QString&, const QString &geometry, bool = false);
00056         void setColumnStatsTypes(const QList<int>& colStatTypes);
00057         void setRange(int start, int end);
00058 
00059         QString baseName(){return d_base_name;}
00060         void setBaseName(const QString& name){d_base_name = name;}
00061 
00062     public slots:
00064         void update();
00066         void update(Table*, const QString& colName);
00068         void renameCol(const QString&, const QString&);
00070         void removeCol(const QString&);
00071 
00072     private slots:
00073         void closedBase();
00074         void removeStatsCol(int);
00075         void moveColumn(int, int, int);
00076         void changeColIndex(int, int);
00077         void insertCols(int start, int count);
00078         void addCol(PlotDesignation pd = Y);
00079     
00080     private:
00081         Table *d_base;
00082         Type d_type;
00083         QList<int> d_targets;
00084         QList<int> d_stats_col_type;
00085         int d_start, d_end;
00086         QString d_base_name;
00087 };
00088 
00089 #endif