summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/graphinfo.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/graphinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/checkbook/graphinfo.cpp45
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,
40 40
41GraphInfo::~GraphInfo()
42{
43 if ( d )
44 {
45 for ( DataPointInfo *data = d->first(); data; data = d->next() )
46 {
47 delete data;
48 }
49 }
50}
51
41GraphInfo::GraphType GraphInfo::graphType() 52GraphInfo::GraphType GraphInfo::graphType()
@@ -60,10 +71,38 @@ void GraphInfo::setDataPoints( DataPointList *data )
60 71
61float GraphInfo::maxValue() 72DataPointInfo *GraphInfo::firstDataPoint()
62{ 73{
63 float max; 74 return( d->first() );
75}
64 76
77DataPointInfo *GraphInfo::nextDataPoint()
78{
79 return( d->next() );
65} 80}
66 81
67float GraphInfo::minValue() 82int GraphInfo::numberDataPoints()
68{ 83{
84 return( d->count() );
85}
86
87float GraphInfo::maxValue()
88{
89 float max = 0.0;
90 for ( DataPointInfo *data = d->first(); data; data = d->next() )
91 {
92 if ( data->value() > max )
93 {
94 max = data->value();
95 }
96 }
97 return max;
98}
99
100float GraphInfo::totalValue()
101{
102 float sum = 0.0;
103 for ( DataPointInfo *data = d->first(); data; data = d->next() )
104 {
105 sum += data->value();
106 }
107 return sum;
69} 108}