Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

graphinfo.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the OPIE Project
00003                =.
00004              .=l.            Copyright (c)  2002 Dan Williams <drw@handhelds.org>
00005            .>+-=
00006  _;:,     .>    :=|.         This file is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00011      ._= =}       :          or (at your option) any later version.
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This file is distributed in the hope that
00014      +  .  -:.       =       it will be useful, but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU General
00018 ..}^=.=       =       ;      Public License for more details.
00019 ++=   -.     .`     .:
00020  :     =  ...= . :.=-        You should have received a copy of the GNU
00021  -.   .:....=;==+<;          General Public License along with this file;
00022   -_. . .   )=.  =           see the file COPYING. If not, write to the
00023     --        :-=`           Free Software Foundation, Inc.,
00024                              59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 #ifndef GRAPHINFO_H
00030 #define GRAPHINFO_H
00031 
00032 #include <qlist.h>
00033 #include <qstringlist.h>
00034 
00035 class DataPointInfo
00036 {
00037         public:
00038                 DataPointInfo()
00039                         : l( 0x0 ), v( 0.0 ) {}
00040                 DataPointInfo( const QString &label, float value )
00041                         : l( label ), v( value ) {}
00042 
00043                 const QString &label() { return l; }
00044                 float          value() { return v; }
00045 
00046                 void addToValue( float value ) { v += value; }
00047 
00048         private:
00049                 QString l;
00050                 float   v;
00051 };
00052 
00053 typedef QList<DataPointInfo> DataPointList;
00054 
00055 class GraphInfo
00056 {
00057         public:
00058                 enum GraphType { BarChart, PieChart };
00059 
00060                 GraphInfo( GraphType = BarChart, DataPointList * = 0x0,
00061                                    const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 );
00062                 ~GraphInfo();
00063 
00064                 GraphInfo::GraphType graphType();
00065                 void                 setGraphType( GraphType );
00066 
00067                 DataPointList *dataPoints();
00068                 void           setDataPoints( DataPointList * );
00069                 DataPointInfo *firstDataPoint();
00070                 DataPointInfo *nextDataPoint();
00071                 int            numberDataPoints();
00072 
00073                 float maxValue();
00074                 float minValue();
00075                 float totalValue();
00076 
00077                 void setGraphTitle( const QString & );
00078                 void setXAxisTitle( const QString & );
00079                 void setYAxisTitle( const QString & );
00080 
00081         private:
00082                 GraphType      t;
00083                 DataPointList *d;
00084                 QString        gt;
00085                 QString        xt;
00086                 QString        yt;
00087 };
00088 
00089 #endif

Generated on Sat Nov 5 16:16:47 2005 for OPIE by  doxygen 1.4.2