← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18782: DV aggregation type, work in progress.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18782 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-31 15:53:02 +0200
message:
  DV aggregation type, work in progress.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-03-10 10:06:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-03-31 13:02:15 +0000
@@ -1677,6 +1677,10 @@
 					delete layout.sorting;
 				}
 
+				if (layout.aggregationType === 'default') {
+					delete layout.aggregationType;
+				}
+
 				delete layout.parentGraphMap;
 				delete layout.reportingPeriod;
 				delete layout.organisationUnit;
@@ -1685,7 +1689,6 @@
 				delete layout.cumulative;
 				delete layout.sortOrder;
 				delete layout.topLimit;
-                delete layout.aggregationType;
 
 				return layout;
 			};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/i18n/i18n_app.properties	2015-03-24 07:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/i18n/i18n_app.properties	2015-03-31 13:02:15 +0000
@@ -250,3 +250,11 @@
 user_sub_x2_units=User sub-x2-units
 metadata_id_scheme=Meta-data ID scheme
 chart_layout=Chart layout
+aggregation_type=Aggregation type
+by_data_element=By data element
+count=Count
+sum=Sum
+stddev=Standard deviation
+variance=Variance
+min=Min
+max=Max

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2015-03-24 07:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2015-03-31 13:02:15 +0000
@@ -724,6 +724,31 @@
 			})
 		});
 
+		aggregationType = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'ns-combo',
+			style: 'margin-bottom:' + comboBottomMargin + 'px',
+			width: cmpWidth,
+			labelWidth: 125,
+			fieldLabel: NS.i18n.aggregation_type,
+			labelStyle: 'color:#333',
+			queryMode: 'local',
+			valueField: 'id',
+			editable: false,
+			value: 'default',
+			store: Ext.create('Ext.data.Store', {
+				fields: ['id', 'text'],
+				data: [
+					{id: 'default', text: NS.i18n.by_data_element},
+					{id: 'count', text: NS.i18n.count},
+					{id: 'sum', text: NS.i18n.sum},
+					{id: 'stddev', text: NS.i18n.stddev},
+					{id: 'variance', text: NS.i18n.variance},
+					{id: 'min', text: NS.i18n.min},
+					{id: 'max', text: NS.i18n.max}
+				]
+			})
+		});
+
         // axes
 		rangeAxisMinValue = Ext.create('Ext.form.field.Number', {
 			width: numberWidth,
@@ -842,7 +867,8 @@
 						baseLineTitle
 					]
 				},
-                sortOrder
+                sortOrder,
+                aggregationType
 			]
 		};
 
@@ -898,6 +924,7 @@
 					baseLineValue: baseLineValue.getValue(),
 					baseLineTitle: baseLineTitle.getValue(),
                     sortOrder: sortOrder.getValue(),
+                    aggregationType: aggregationType.getValue(),
 					rangeAxisMaxValue: rangeAxisMaxValue.getValue(),
 					rangeAxisMinValue: rangeAxisMinValue.getValue(),
 					rangeAxisSteps: rangeAxisSteps.getValue(),
@@ -945,6 +972,7 @@
 				}
 
                 sortOrder.setValue(Ext.isNumber(layout.sortOrder) ? layout.sortOrder : 0);
+                aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
 
 				// rangeAxisMaxValue
 				if (Ext.isNumber(layout.rangeAxisMaxValue)) {
@@ -1067,6 +1095,7 @@
 					w.baseLineValue = baseLineValue;
 					w.baseLineTitle = baseLineTitle;
                     w.sortOrder = sortOrder;
+                    w.aggregationType = aggregationType;
 
 					w.rangeAxisMaxValue = rangeAxisMaxValue;
 					w.rangeAxisMinValue = rangeAxisMinValue;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2015-03-30 13:36:53 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2015-03-31 13:02:15 +0000
@@ -855,6 +855,8 @@
 
                 // sortOrder: number
 
+                // aggregationType: string ('default') - 'default', 'count', 'sum', 'stddev', 'variance', 'min', 'max'
+
                 // rangeAxisMaxValue: number
 
                 // rangeAxisMinValue: number
@@ -1101,6 +1103,7 @@
                     layout.baseLineTitle = Ext.isString(config.baseLineLabel) && !Ext.isEmpty(config.baseLineLabel) ? config.baseLineLabel :
                         (Ext.isString(config.baseLineTitle) && !Ext.isEmpty(config.baseLineTitle) ? config.baseLineTitle : null);
                     layout.sortOrder = Ext.isNumber(config.sortOrder) ? config.sortOrder : 0;
+                    layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'default';
 
 					layout.rangeAxisMaxValue = Ext.isNumber(config.rangeAxisMaxValue) ? config.rangeAxisMaxValue : null;
 					layout.rangeAxisMinValue = Ext.isNumber(config.rangeAxisMinValue) ? config.rangeAxisMinValue : null;
@@ -2171,7 +2174,15 @@
                     paramString = '?',
                     addCategoryDimension = false,
                     map = xLayout.dimensionNameItemsMap,
-                    dx = dimConf.indicator.dimensionName;
+                    dx = dimConf.indicator.dimensionName,
+                    aggTypes = {
+                        'count': 'COUNT',
+                        'sum': 'SUM',
+                        'stddev': 'STDDEV',
+                        'variance': 'VARIANCE',
+                        'min': 'MIN',
+                        'max': 'MAX'
+                    };
 
                 for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
                     dimName = axisDimensionNames[i];
@@ -2214,6 +2225,11 @@
                     }
                 }
 
+                // aggregation type
+                if (aggTypes.hasOwnProperty(xLayout.aggregationType)) {
+                    paramString += '&aggregationType=' + aggTypes[xLayout.aggregationType];
+                }
+
                 // display property
                 paramString += '&displayProperty=' + init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();