← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11497: (DV) Radar chart implemented.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11497 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-07-24 12:34:26 +0200
message:
  (DV) Radar chart implemented.
added:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/radar.png
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties
  dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm


--
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-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2013-06-26 12:18:21 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2013-07-24 10:33:49 +0000
@@ -7,6 +7,7 @@
 line_chart=Line chart
 area_chart=Area chart
 pie_chart=Pie chart
+radar_chart=Radar chart
 series=Series
 category=Category
 filter=Filter

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties	2013-07-02 15:58:13 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties	2013-07-24 10:33:49 +0000
@@ -179,4 +179,5 @@
 select_boundaries_and_level=S\u00E9lectionner limites et le niveau
 select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation
 details=D\u00E9tails
-totals=Totaux
\ No newline at end of file
+totals=Totaux
+radar_chart=Graphique en radar
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/radar.png'
Binary files dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/radar.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/radar.png	2013-07-24 10:23:02 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-07-22 15:03:42 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-07-24 10:23:02 +0000
@@ -2015,6 +2015,7 @@
 				line,
 				area,
 				pie,
+				radar,
 				buttons = [],
 				buttonAddedListener,
 				chartType,
@@ -2152,6 +2153,17 @@
 					added: buttonAddedListener
 				}
 			});
+			
+			radar = Ext.create('Ext.button.Button', {
+				xtype: 'button',
+				chartType: dv.conf.finals.chart.radar,
+				icon: 'images/radar.png',
+				name: dv.conf.finals.chart.radar,
+				tooltipText: DV.i18n.radar_chart,
+				listeners: {
+					added: buttonAddedListener
+				}
+			});
 
 			chartType = Ext.create('Ext.toolbar.Toolbar', {
 				height: 45,
@@ -2198,7 +2210,8 @@
 					stackedbar,
 					line,
 					area,
-					pie
+					pie,
+					radar
 				]
 			});
 

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2013-07-23 13:54:03 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2013-07-24 10:23:02 +0000
@@ -108,7 +108,8 @@
             stackedbar: 'stackedbar',
             line: 'line',
             area: 'area',
-            pie: 'pie'
+            pie: 'pie',
+            radar: 'radar'
         },
         data: {
 			domain: 'domain_',
@@ -1378,7 +1379,7 @@
 				};
 			};
 
-			getDefaultChart = function(store, axes, series, xResponse, xLayout) {
+			getDefaultChart = function(store, axes, series, xResponse, xLayout, theme) {
 				var chart,
 					config = {
 						store: store,
@@ -1389,7 +1390,7 @@
 						insetPadding: 35,
 						width: dv.viewport.centerRegion.getWidth(),
 						height: dv.viewport.centerRegion.getHeight() - 25,
-						theme: 'dv1'
+						theme: theme || 'dv1'
 					};
 
 				// Legend
@@ -1718,6 +1719,61 @@
 				return chart;
 			};
 
+			generator.radar = function(xResponse, xLayout) {
+				var store = getDefaultStore(xResponse, xLayout),
+					axes = [],
+					series = [],
+					seriesTitles = getDefaultSeriesTitle(store, xResponse),
+					chart;
+					
+				// Axes
+				axes.push({
+					type: 'Radial',
+					position: 'radial',
+					label: {
+						display: true
+					}
+				});
+
+				// Series
+				for (var i = 0, obj; i < store.rangeFields.length; i++) {
+					obj = {
+						showInLegend: true,
+						type: 'radar',
+						xField: store.domainFields,
+						yField: store.rangeFields[i],
+						style: {
+							opacity: 0.5
+						},
+						tips: getDefaultTips(),
+						title: seriesTitles[i]
+					};
+
+					if (xLayout.showValues) {
+						obj.label = {
+							display: 'over',
+							field: store.rangeFields[i]
+						};
+					}
+
+					series.push(obj);
+				}
+
+				chart = getDefaultChart(store, axes, series, xResponse, xLayout, 'Category2');
+				
+				chart.insetPadding = 40;
+				chart.height = dv.viewport.centerRegion.getHeight() - 80;
+				
+				chart.setChartSize = function() {
+					this.animate = false;
+					this.setWidth(dv.viewport.centerRegion.getWidth());
+					this.setHeight(dv.viewport.centerRegion.getHeight() - 80);
+					this.animate = true;
+				};
+				
+				return chart;
+			};				
+
 			initialize = function() {
 				var url,
 					xLayout,

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2013-06-26 12:18:21 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2013-07-24 10:33:49 +0000
@@ -197,5 +197,6 @@
     sharing_settings: '$encoder.jsEscape($i18n.getString( 'sharing_settings' ) , "'")',
 	select_organisation_units: '$encoder.jsEscape($i18n.getString( 'select_organisation_units' ) , "'")',
 	select_boundaries_and_level: '$encoder.jsEscape($i18n.getString( 'select_boundaries_and_level' ) , "'")',
-	select_organisation_unit_level: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_level' ) , "'")'
+	select_organisation_unit_level: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_level' ) , "'")',
+	radar_chart: '$encoder.jsEscape($i18n.getString( 'radar_chart' ) , "'")'
 };