author | drw <drw> | 2002-11-02 21:45:56 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-02 21:45:56 (UTC) |
commit | 2dc81c48428222533e5479947d9ad318e464bafa (patch) (side-by-side diff) | |
tree | 2e3570d18f3574c49ffc8aaf287bac4822ff3a11 /noncore/apps/checkbook/graphinfo.cpp | |
parent | 5e1893923a9ddf1e2bd3e8f9c0dd264d86b8d98d (diff) | |
download | opie-2dc81c48428222533e5479947d9ad318e464bafa.zip opie-2dc81c48428222533e5479947d9ad318e464bafa.tar.gz opie-2dc81c48428222533e5479947d9ad318e464bafa.tar.bz2 |
Implementing charting...
Diffstat (limited to 'noncore/apps/checkbook/graphinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/graphinfo.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp index 7b06bdb..ec6a465 100644 --- a/noncore/apps/checkbook/graphinfo.cpp +++ b/noncore/apps/checkbook/graphinfo.cpp @@ -40,2 +40,13 @@ GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title, +GraphInfo::~GraphInfo() +{ + if ( d ) + { + for ( DataPointInfo *data = d->first(); data; data = d->next() ) + { + delete data; + } + } +} + GraphInfo::GraphType GraphInfo::graphType() @@ -60,10 +71,38 @@ void GraphInfo::setDataPoints( DataPointList *data ) -float GraphInfo::maxValue() +DataPointInfo *GraphInfo::firstDataPoint() { - float max; + return( d->first() ); +} +DataPointInfo *GraphInfo::nextDataPoint() +{ + return( d->next() ); } -float GraphInfo::minValue() +int GraphInfo::numberDataPoints() { + return( d->count() ); +} + +float GraphInfo::maxValue() +{ + float max = 0.0; + for ( DataPointInfo *data = d->first(); data; data = d->next() ) + { + if ( data->value() > max ) + { + max = data->value(); + } + } + return max; +} + +float GraphInfo::totalValue() +{ + float sum = 0.0; + for ( DataPointInfo *data = d->first(); data; data = d->next() ) + { + sum += data->value(); + } + return sum; } |