Diffstat (limited to 'noncore/apps/checkbook/graphinfo.cpp') (more/less context) (ignore 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 | |||
@@ -52,72 +52,85 @@ GraphInfo::~GraphInfo() | |||
52 | GraphInfo::GraphType GraphInfo::graphType() | 52 | GraphInfo::GraphType GraphInfo::graphType() |
53 | { | 53 | { |
54 | return t; | 54 | return t; |
55 | } | 55 | } |
56 | 56 | ||
57 | void GraphInfo::setGraphType( GraphType type ) | 57 | void GraphInfo::setGraphType( GraphType type ) |
58 | { | 58 | { |
59 | t = type; | 59 | t = type; |
60 | } | 60 | } |
61 | 61 | ||
62 | DataPointList *GraphInfo::dataPoints() | 62 | DataPointList *GraphInfo::dataPoints() |
63 | { | 63 | { |
64 | return d; | 64 | return d; |
65 | } | 65 | } |
66 | 66 | ||
67 | void GraphInfo::setDataPoints( DataPointList *data ) | 67 | void GraphInfo::setDataPoints( DataPointList *data ) |
68 | { | 68 | { |
69 | d = data; | 69 | d = data; |
70 | } | 70 | } |
71 | 71 | ||
72 | DataPointInfo *GraphInfo::firstDataPoint() | 72 | DataPointInfo *GraphInfo::firstDataPoint() |
73 | { | 73 | { |
74 | return( d->first() ); | 74 | return( d->first() ); |
75 | } | 75 | } |
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 | } |