Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/kreportchartview.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 81 | { | |||
---|---|---|---|---|---|
111 | setSeriesTotals(false); | 111 | setSeriesTotals(false); | ||
112 | 112 | | |||
113 | // whether series (rows) are accounts (true) or months (false). This causes a lot | 113 | // whether series (rows) are accounts (true) or months (false). This causes a lot | ||
114 | // of complexity in the charts. The problem is that circular reports work best with | 114 | // of complexity in the charts. The problem is that circular reports work best with | ||
115 | // an account in a COLUMN, while line/bar prefer it in a ROW. | 115 | // an account in a COLUMN, while line/bar prefer it in a ROW. | ||
116 | setAccountSeries(true); | 116 | setAccountSeries(true); | ||
117 | 117 | | |||
118 | switch (config.chartType()) { | 118 | switch (config.chartType()) { | ||
119 | case MyMoneyReport::eChartNone: | 119 | case MyMoneyReport::Chart::None: | ||
120 | case MyMoneyReport::eChartEnd: | 120 | case MyMoneyReport::Chart::End: | ||
121 | case MyMoneyReport::eChartLine: { | 121 | case MyMoneyReport::Chart::Line: { | ||
122 | KDChart::LineDiagram* diagram = new KDChart::LineDiagram; | 122 | KDChart::LineDiagram* diagram = new KDChart::LineDiagram; | ||
123 | 123 | | |||
124 | if (config.isSkippingZero()) { | 124 | if (config.isSkippingZero()) { | ||
125 | LineAttributes attributes = diagram->lineAttributes(); | 125 | LineAttributes attributes = diagram->lineAttributes(); | ||
126 | attributes.setMissingValuesPolicy(LineAttributes::MissingValuesAreBridged); | 126 | attributes.setMissingValuesPolicy(LineAttributes::MissingValuesAreBridged); | ||
127 | diagram->setLineAttributes(attributes); | 127 | diagram->setLineAttributes(attributes); | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | 130 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | ||
131 | replaceCoordinatePlane(cartesianPlane); | 131 | replaceCoordinatePlane(cartesianPlane); | ||
132 | coordinatePlane()->replaceDiagram(diagram); | 132 | coordinatePlane()->replaceDiagram(diagram); | ||
133 | break; | 133 | break; | ||
134 | } | 134 | } | ||
135 | case MyMoneyReport::eChartBar: { | 135 | case MyMoneyReport::Chart::Bar: { | ||
136 | KDChart::BarDiagram* diagram = new KDChart::BarDiagram; | 136 | KDChart::BarDiagram* diagram = new KDChart::BarDiagram; | ||
137 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | 137 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | ||
138 | replaceCoordinatePlane(cartesianPlane); | 138 | replaceCoordinatePlane(cartesianPlane); | ||
139 | coordinatePlane()->replaceDiagram(diagram); | 139 | coordinatePlane()->replaceDiagram(diagram); | ||
140 | break; | 140 | break; | ||
141 | } | 141 | } | ||
142 | case MyMoneyReport::eChartStackedBar: { | 142 | case MyMoneyReport::Chart::StackedBar: { | ||
143 | KDChart::BarDiagram* diagram = new KDChart::BarDiagram; | 143 | KDChart::BarDiagram* diagram = new KDChart::BarDiagram; | ||
144 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | 144 | CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; | ||
145 | replaceCoordinatePlane(cartesianPlane); | 145 | replaceCoordinatePlane(cartesianPlane); | ||
146 | diagram->setType(BarDiagram::Stacked); | 146 | diagram->setType(BarDiagram::Stacked); | ||
147 | coordinatePlane()->replaceDiagram(diagram); | 147 | coordinatePlane()->replaceDiagram(diagram); | ||
148 | break; | 148 | break; | ||
149 | } | 149 | } | ||
150 | case MyMoneyReport::eChartPie: { | 150 | case MyMoneyReport::Chart::Pie: { | ||
151 | KDChart::PieDiagram* diagram = new KDChart::PieDiagram; | 151 | KDChart::PieDiagram* diagram = new KDChart::PieDiagram; | ||
152 | PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; | 152 | PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; | ||
153 | replaceCoordinatePlane(polarPlane); | 153 | replaceCoordinatePlane(polarPlane); | ||
154 | coordinatePlane()->replaceDiagram(diagram); | 154 | coordinatePlane()->replaceDiagram(diagram); | ||
155 | setAccountSeries(false); | 155 | setAccountSeries(false); | ||
156 | setSeriesTotals(true); | 156 | setSeriesTotals(true); | ||
157 | break; | 157 | break; | ||
158 | } | 158 | } | ||
159 | case MyMoneyReport::eChartRing: { | 159 | case MyMoneyReport::Chart::Ring: { | ||
160 | KDChart::RingDiagram* diagram = new KDChart::RingDiagram; | 160 | KDChart::RingDiagram* diagram = new KDChart::RingDiagram; | ||
161 | PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; | 161 | PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; | ||
162 | replaceCoordinatePlane(polarPlane); | 162 | replaceCoordinatePlane(polarPlane); | ||
163 | polarPlane->replaceDiagram(diagram); | 163 | polarPlane->replaceDiagram(diagram); | ||
164 | //chartView.params()->setRelativeRingThickness( true ); | 164 | //chartView.params()->setRelativeRingThickness( true ); | ||
165 | setAccountSeries(false); | 165 | setAccountSeries(false); | ||
166 | break; | 166 | break; | ||
167 | } | 167 | } | ||
Show All 21 Lines | 187 | default: | |||
189 | break; | 189 | break; | ||
190 | } | 190 | } | ||
191 | 191 | | |||
192 | //the legend will be used later | 192 | //the legend will be used later | ||
193 | Legend* legend = new Legend(planeDiagram, this); | 193 | Legend* legend = new Legend(planeDiagram, this); | ||
194 | legend->setTitleText(i18nc("Chart legend title", "Legend")); | 194 | legend->setTitleText(i18nc("Chart legend title", "Legend")); | ||
195 | 195 | | |||
196 | //set up the axes for cartesian diagrams | 196 | //set up the axes for cartesian diagrams | ||
197 | if (config.chartType() == MyMoneyReport::eChartLine || | 197 | if (config.chartType() == MyMoneyReport::Chart::Line || | ||
198 | config.chartType() == MyMoneyReport::eChartBar || | 198 | config.chartType() == MyMoneyReport::Chart::Bar || | ||
199 | config.chartType() == MyMoneyReport::eChartStackedBar) { | 199 | config.chartType() == MyMoneyReport::Chart::StackedBar) { | ||
200 | //set x axis | 200 | //set x axis | ||
201 | CartesianAxis *xAxis = new CartesianAxis(); | 201 | CartesianAxis *xAxis = new CartesianAxis(); | ||
202 | xAxis->setPosition(CartesianAxis::Bottom); | 202 | xAxis->setPosition(CartesianAxis::Bottom); | ||
203 | xAxis->setTitleText(i18n("Time")); | 203 | xAxis->setTitleText(i18n("Time")); | ||
204 | TextAttributes xAxisTitleTextAttr(xAxis->titleTextAttributes()); | 204 | TextAttributes xAxisTitleTextAttr(xAxis->titleTextAttributes()); | ||
205 | xAxisTitleTextAttr.setMinimalFontSize(KGlobalSettings::generalFont().pointSize()); | 205 | xAxisTitleTextAttr.setMinimalFontSize(KGlobalSettings::generalFont().pointSize()); | ||
206 | xAxisTitleTextAttr.setPen(m_foregroundBrush.color()); | 206 | xAxisTitleTextAttr.setPen(m_foregroundBrush.color()); | ||
207 | xAxis->setTitleTextAttributes(xAxisTitleTextAttr); | 207 | xAxis->setTitleTextAttributes(xAxisTitleTextAttr); | ||
Show All 28 Lines | |||||
236 | yAxisTextAttr.setPen(m_foregroundBrush.color()); | 236 | yAxisTextAttr.setPen(m_foregroundBrush.color()); | ||
237 | yAxis->setTextAttributes(yAxisTextAttr); | 237 | yAxis->setTextAttributes(yAxisTextAttr); | ||
238 | RulerAttributes yAxisRulerAttr(yAxis->rulerAttributes()); | 238 | RulerAttributes yAxisRulerAttr(yAxis->rulerAttributes()); | ||
239 | yAxisRulerAttr.setTickMarkPen(m_foregroundBrush.color()); | 239 | yAxisRulerAttr.setTickMarkPen(m_foregroundBrush.color()); | ||
240 | yAxisRulerAttr.setShowRulerLine(true); | 240 | yAxisRulerAttr.setShowRulerLine(true); | ||
241 | yAxis->setRulerAttributes(yAxisRulerAttr); | 241 | yAxis->setRulerAttributes(yAxisRulerAttr); | ||
242 | 242 | | |||
243 | //add the axes to the corresponding diagram | 243 | //add the axes to the corresponding diagram | ||
244 | if (config.chartType() == MyMoneyReport::eChartLine) { | 244 | if (config.chartType() == MyMoneyReport::Chart::Line) { | ||
245 | KDChart::LineDiagram* lineDiagram = qobject_cast<LineDiagram*>(planeDiagram); | 245 | KDChart::LineDiagram* lineDiagram = qobject_cast<LineDiagram*>(planeDiagram); | ||
246 | lineDiagram->addAxis(xAxis); | 246 | lineDiagram->addAxis(xAxis); | ||
247 | lineDiagram->addAxis(yAxis); | 247 | lineDiagram->addAxis(yAxis); | ||
248 | } else if (config.chartType() == MyMoneyReport::eChartBar || | 248 | } else if (config.chartType() == MyMoneyReport::Chart::Bar || | ||
249 | config.chartType() == MyMoneyReport::eChartStackedBar) { | 249 | config.chartType() == MyMoneyReport::Chart::StackedBar) { | ||
250 | KDChart::BarDiagram* barDiagram = qobject_cast<BarDiagram*>(planeDiagram); | 250 | KDChart::BarDiagram* barDiagram = qobject_cast<BarDiagram*>(planeDiagram); | ||
251 | barDiagram->addAxis(xAxis); | 251 | barDiagram->addAxis(xAxis); | ||
252 | barDiagram->addAxis(yAxis); | 252 | barDiagram->addAxis(yAxis); | ||
253 | } | 253 | } | ||
254 | } | 254 | } | ||
255 | 255 | | |||
256 | switch (config.detailLevel()) { | 256 | switch (config.detailLevel()) { | ||
257 | case MyMoneyReport::DetailLevel::None: | 257 | case MyMoneyReport::DetailLevel::None: | ||
▲ Show 20 Lines • Show All 393 Lines • Show Last 20 Lines |