QtiPlot 0.9.8.2
QwtHistogram.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : QwtHistogram.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 - 2009 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Histogram class
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #include "QwtBarCurve.h"
00030 
00031 class Matrix;
00032 
00034 class QwtHistogram: public QwtBarCurve
00035 {
00036 public:
00037     QwtHistogram(Table *t, const QString& name, int startRow = 0, int endRow = -1);
00038     QwtHistogram(Matrix *m);
00039 
00040     void copy(QwtHistogram *h);
00041 
00042     QwtDoubleRect boundingRect() const;
00043 
00044     void setBinning(bool autoBin, double size, double begin, double end);
00046     void setBinning(double binSize, double begin, double end);
00047 
00048     bool autoBinning(){return d_autoBin;};
00050     void setAutoBinning(bool autoBin = true);
00051 
00052     double begin(){return d_begin;};
00053     double end(){return d_end;};
00054     double binSize(){return d_bin_size;};
00055 
00056     void loadData();
00057 
00058     double mean(){return d_mean;};
00059     double standardDeviation(){return d_standard_deviation;};
00060     double minimum(){return d_min;};
00061     double maximum(){return d_max;};
00062 
00063     Matrix* matrix(){return d_matrix;};
00064 
00065 private:
00066     void init();
00067     void draw(QPainter *painter,const QwtScaleMap &xMap,
00068         const QwtScaleMap &yMap, int from, int to) const;
00069 
00070     void loadDataFromMatrix();
00071     virtual void loadLabels();
00072 
00073     Matrix *d_matrix;
00074 
00075     bool d_autoBin;
00076     double d_bin_size, d_begin, d_end;
00077 
00079     double d_mean, d_standard_deviation, d_min, d_max;
00080 };