author | drw <drw> | 2004-03-30 17:49:34 (UTC) |
---|---|---|
committer | drw <drw> | 2004-03-30 17:49:34 (UTC) |
commit | c74a24cbd04cb74d832908eb2b373aed7b3cea71 (patch) (unidiff) | |
tree | 3ea474f4c8fa64495b8e0604f34ae5a1bd55ac56 /noncore/apps/checkbook/graphinfo.cpp | |
parent | 2e5d236b647b1747dca61486ecdd85c8f3869487 (diff) | |
download | opie-c74a24cbd04cb74d832908eb2b373aed7b3cea71.zip opie-c74a24cbd04cb74d832908eb2b373aed7b3cea71.tar.gz opie-c74a24cbd04cb74d832908eb2b373aed7b3cea71.tar.bz2 |
Fix drawing of account balance graph when balance < 0.0
Diffstat (limited to 'noncore/apps/checkbook/graphinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/graphinfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp index fec6896..5b72c80 100644 --- a/noncore/apps/checkbook/graphinfo.cpp +++ b/noncore/apps/checkbook/graphinfo.cpp | |||
@@ -76,48 +76,61 @@ DataPointInfo *GraphInfo::firstDataPoint() | |||
76 | 76 | ||
77 | DataPointInfo *GraphInfo::nextDataPoint() | 77 | DataPointInfo *GraphInfo::nextDataPoint() |
78 | { | 78 | { |
79 | return( d->next() ); | 79 | return( d->next() ); |
80 | } | 80 | } |
81 | 81 | ||
82 | int GraphInfo::numberDataPoints() | 82 | int GraphInfo::numberDataPoints() |
83 | { | 83 | { |
84 | return( d->count() ); | 84 | return( d->count() ); |
85 | } | 85 | } |
86 | 86 | ||
87 | float GraphInfo::maxValue() | 87 | float GraphInfo::maxValue() |
88 | { | 88 | { |
89 | float max = 0.0; | 89 | float max = 0.0; |
90 | for ( DataPointInfo *data = d->first(); data; data = d->next() ) | 90 | for ( DataPointInfo *data = d->first(); data; data = d->next() ) |
91 | { | 91 | { |
92 | if ( data->value() > max ) | 92 | if ( data->value() > max ) |
93 | { | 93 | { |
94 | max = data->value(); | 94 | max = data->value(); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | return max; | 97 | return max; |
98 | } | 98 | } |
99 | 99 | ||
100 | float GraphInfo::minValue() | ||
101 | { | ||
102 | float min = 0.0; | ||
103 | for ( DataPointInfo *data = d->first(); data; data = d->next() ) | ||
104 | { | ||
105 | if ( data->value() < min ) | ||
106 | { | ||
107 | min = data->value(); | ||
108 | } | ||
109 | } | ||
110 | return min; | ||
111 | } | ||
112 | |||
100 | float GraphInfo::totalValue() | 113 | float GraphInfo::totalValue() |
101 | { | 114 | { |
102 | float sum = 0.0; | 115 | float sum = 0.0; |
103 | for ( DataPointInfo *data = d->first(); data; data = d->next() ) | 116 | for ( DataPointInfo *data = d->first(); data; data = d->next() ) |
104 | { | 117 | { |
105 | sum += data->value(); | 118 | sum += data->value(); |
106 | } | 119 | } |
107 | return sum; | 120 | return sum; |
108 | } | 121 | } |
109 | 122 | ||
110 | void GraphInfo::setGraphTitle( const QString &title ) | 123 | void GraphInfo::setGraphTitle( const QString &title ) |
111 | { | 124 | { |
112 | gt = title; | 125 | gt = title; |
113 | } | 126 | } |
114 | 127 | ||
115 | void GraphInfo::setXAxisTitle( const QString &xtitle ) | 128 | void GraphInfo::setXAxisTitle( const QString &xtitle ) |
116 | { | 129 | { |
117 | xt = xtitle; | 130 | xt = xtitle; |
118 | } | 131 | } |
119 | 132 | ||
120 | void GraphInfo::setYAxisTitle( const QString &ytitle ) | 133 | void GraphInfo::setYAxisTitle( const QString &ytitle ) |
121 | { | 134 | { |
122 | yt = ytitle; | 135 | yt = ytitle; |
123 | } | 136 | } |