← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6645: (DV) Show data on chart option implemented.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 6645 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-19 16:00:00 +0200
message:
  (DV) Show data on chart option implemented.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java
  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/webapp/dhis-web-visualizer/app/app.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-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-04-18 20:24:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-04-19 13:58:20 +0000
@@ -130,6 +130,8 @@
     private boolean userOrganisationUnit;
 
     private boolean userOrganisationUnitChildren;
+    
+    private boolean showData;
 
     private User user;
 
@@ -604,6 +606,20 @@
     }
 
     @JsonProperty
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public boolean isShowData()
+    {
+        return showData;
+    }
+
+    public void setShowData( boolean showData )
+    {
+        this.showData = showData;
+    }
+    
+
+    @JsonProperty
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-03-30 13:32:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-04-19 08:56:40 +0000
@@ -283,6 +283,10 @@
         
         executeSql( "ALTER TABLE chart DROP COLUMN domainaxixlabel" );
         
+        executeSql( "UPDATE chart SET userorganisationunit=false WHERE userorganisationunit IS NULL" );
+        executeSql( "UPDATE chart SET userorganisationunitchildren=false WHERE userorganisationunitchildren IS NULL" );
+        executeSql( "UPDATE chart SET showdata=false WHERE showdata IS NULL" );        
+        
         // remove outdated relative periods
         
         executeSql( "ALTER TABLE reporttable DROP COLUMN last3months" );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2012-03-09 02:29:32 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2012-04-19 13:58:20 +0000
@@ -88,6 +88,10 @@
     </component>
 
     <property name="userOrganisationUnit" not-null="true" />
+	  
+    <property name="userOrganisationUnitChildren" not-null="true" />
+
+    <property name="showData" not-null="true" />
     
     <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_chart_userid" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-04-17 14:23:08 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-04-19 13:58:20 +0000
@@ -287,6 +287,13 @@
         this.userOrganisationUnitChildren = userOrganisationUnitChildren;
     }
 
+    private Boolean showData;
+
+    public void setShowData( Boolean showData )
+    {
+        this.showData = showData;
+    }
+
     private String domainAxisLabel;
 
     public void setDomainAxisLabel( String domainAxisLabel )
@@ -469,6 +476,11 @@
             chart.setUserOrganisationUnitChildren( userOrganisationUnitChildren );
         }
 
+        if ( showData != null )
+        {
+            chart.setShowData( showData );
+        }
+
         if ( domainAxisLabel != null )
         {
             chart.setDomainAxisLabel( domainAxisLabel );

=== 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	2012-04-17 14:23:08 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2012-04-18 11:33:06 +0000
@@ -121,4 +121,5 @@
 wm_first_filter_used=The first one is being used.
 available_attribute = Available attribute 
 selected_attribute = Selected attribute
-user_orgunit_children = User orgunit children
\ No newline at end of file
+user_orgunit_children = User orgunit children
+show_data = Show data 
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-04-17 15:59:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-04-18 11:33:06 +0000
@@ -1018,9 +1018,9 @@
             line: {
 				series: {
 					getArray: function() {
-						var a = [];
+						var series = [];
 						for (var i = 0; i < DV.c.series.names.length; i++) {
-							a.push({
+							var main = {
 								type: 'line',
 								axis: 'left',
 								xField: DV.conf.finals.data.domain,
@@ -1034,9 +1034,10 @@
 									radius: 4
 								},
 								tips: DV.util.chart.def.series.getTips()
-							});
+							};
+							series.push(main);
 						}
-						return a;
+						return series;
 					},
 					setTheme: function() {
 						var colors = DV.conf.chart.theme.dv1.slice(0, DV.c.series.names.length);
@@ -1493,7 +1494,7 @@
     DV.state = {
         setChart: function(exe, id) {
 			DV.chart.reset();
-						
+			
 			if (id) {
                 Ext.Ajax.request({
                     url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.favorite_get + id + '.json?links=false',
@@ -1547,6 +1548,7 @@
                         DV.c.trendline = f.regression;
                         DV.c.userorganisationunit = f.userOrganisationUnit;
                         DV.c.userorganisationunitchildren = f.userOrganisationUnitChildren;
+                        DV.c.showdata = f.showData;
                         DV.c.domainaxislabel = f.domainAxisLabel;
                         DV.c.rangeaxislabel = f.rangeAxisLabel;
                         DV.c.targetlinevalue = f.targetLineValue ? parseFloat(f.targetLineValue) : null;
@@ -1645,6 +1647,7 @@
             DV.c.trendline = DV.cmp.favorite.trendline.getValue();
             DV.c.userorganisationunit = DV.cmp.favorite.userorganisationunit.getValue();
             DV.c.userorganisationunitchildren = DV.cmp.favorite.userorganisationunitchildren.getValue();
+            DV.c.showdata = DV.cmp.favorite.showdata.getValue();
             DV.c.domainaxislabel = DV.cmp.favorite.domainaxislabel.getValue();
             DV.c.rangeaxislabel = DV.cmp.favorite.rangeaxislabel.getValue();
             DV.c.targetlinevalue = parseFloat(DV.cmp.favorite.targetlinevalue.getValue());
@@ -1663,6 +1666,7 @@
 			p.trendLine = DV.c.trendline;
 			p.userOrganisationUnit = DV.c.userorganisationunit;
 			p.userOrganisationUnitChildren = DV.c.userorganisationunitchildren;
+			p.showData = DV.c.showdata;
 			if (DV.c.domainaxislabel) {
 				p.domainAxisLabel = DV.c.domainaxislabel;
 			}
@@ -1698,6 +1702,7 @@
 			DV.cmp.favorite.trendline.setValue(DV.c.trendline);
 			DV.cmp.favorite.userorganisationunit.setValue(DV.c.userorganisationunit);
 			DV.cmp.favorite.userorganisationunitchildren.setValue(DV.c.userorganisationunitchildren);
+			DV.cmp.favorite.showdata.setValue(DV.c.showdata);
 			DV.cmp.favorite.domainaxislabel.setValue(DV.c.domainaxislabel);
 			DV.cmp.favorite.rangeaxislabel.setValue(DV.c.rangeaxislabel);
 			DV.cmp.favorite.targetlinevalue.setValue(DV.c.targetlinevalue);
@@ -1959,6 +1964,7 @@
 			trendline: false,
 			userorganisationunit: false,
 			userorganisationunitchildren: false,
+			showdata: false,
 			domainaxislabel: null,
 			rangeaxislabel: null,
 			targetlinevalue: null,
@@ -1982,7 +1988,8 @@
 			this.model.hidelegend = false;
 			this.model.trendline = false;
 			this.model.userorganisationunit = false;
-			this.model.userorganisationunitchildren = false;			
+			this.model.userorganisationunitchildren = false;
+			this.model.showdata = false;
 			this.model.domainaxislabel = null;
 			this.model.rangeaxislabel = null;
 			this.model.targetlinevalue = null;
@@ -2073,7 +2080,7 @@
 					series.push(a[i]);
 				}
 			}
-			series.push({
+			var main = {
 				type: 'column',
 				axis: 'left',
 				xField: DV.conf.finals.data.domain,
@@ -2082,9 +2089,13 @@
 				style: {
 					opacity: 0.8,
 					stroke: '#333'
-				},				
+				},
 				tips: DV.util.chart.def.series.getTips()
-			});
+			};
+			if (DV.c.showdata) {
+				main.label = {display: 'outside', field: DV.c.series.names};
+			}
+			series.push(main);
 			if (DV.c.targetlinevalue) {
 				series.push(DV.util.chart.def.series.getTargetLine());
 			}
@@ -2111,7 +2122,7 @@
 					series.push(a[i]);
 				}
 			}
-			series.push({
+			var main = {
 				type: 'bar',
 				axis: 'bottom',
 				xField: DV.conf.finals.data.domain,
@@ -2122,7 +2133,11 @@
 					stroke: '#333'
 				},
 				tips: DV.util.chart.def.series.getTips()
-			});
+			};
+			if (DV.c.showdata) {
+				main.label = {display: 'outside', field: DV.c.series.names};
+			}
+			series.push(main);
 			if (DV.c.targetlinevalue) {
 				series.push(DV.util.chart.bar.series.getTargetLine());
 			}
@@ -3255,6 +3270,17 @@
 														items: [
 															{
 																xtype: 'checkbox',
+																width: 126,
+																boxLabel: DV.i18n.show_data,
+																labelWidth: DV.conf.layout.form_label_width,
+																listeners: {
+																	added: function() {
+																		DV.cmp.favorite.showdata = this;
+																	}
+																}
+															},
+															{
+																xtype: 'checkbox',
 																width: 124,
 																boxLabel: DV.i18n.hide_subtitle,
 																labelWidth: DV.conf.layout.form_label_width,
@@ -3266,7 +3292,7 @@
 															},
 															{
 																xtype: 'checkbox',
-																width: 130,
+																width: 128,
 																boxLabel: DV.i18n.user_orgunit,
 																labelWidth: DV.conf.layout.form_label_width,
 																listeners: {
@@ -3274,10 +3300,17 @@
 																		DV.cmp.favorite.userorganisationunit = this;
 																	}
 																}
-															},
+															}
+														]
+													},
+													{
+														xtype: 'panel',
+														layout: 'column',
+														bodyStyle: 'border-style:none; background-color:transparent; padding-bottom:15px',
+														items: [
 															{
 																xtype: 'checkbox',
-																width: 124,
+																width: 126,
 																boxLabel: DV.i18n.trend_line,
 																labelWidth: DV.conf.layout.form_label_width,
 																listeners: {
@@ -3285,14 +3318,7 @@
 																		DV.cmp.favorite.trendline = this;
 																	}
 																}
-															}
-														]
-													},
-													{
-														xtype: 'panel',
-														layout: 'column',
-														bodyStyle: 'border-style:none; background-color:transparent; padding-bottom:15px',
-														items: [
+															},
 															{
 																xtype: 'checkbox',
 																width: 124,
@@ -3306,7 +3332,7 @@
 															},
 															{
 																xtype: 'checkbox',
-																width: 130,
+																width: 128,
 																boxLabel: DV.i18n.user_orgunit_children,
 																labelWidth: DV.conf.layout.form_label_width,
 																listeners: {

=== 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	2012-04-17 14:23:08 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-04-18 11:33:06 +0000
@@ -120,6 +120,7 @@
 wm_multiple_filter_orgunit:'$encoder.jsEscape($i18n.getString( 'wm_multiple_filter_orgunit' ) , "'")',
 wm_multiple_filter_groups:'$encoder.jsEscape($i18n.getString( 'wm_multiple_filter_groups' ) , "'")',
 wm_first_filter_used:'$encoder.jsEscape($i18n.getString( 'wm_first_filter_used' ) , "'")',
-user_orgunit_children:'$encoder.jsEscape($i18n.getString( 'user_orgunit_children' ) , "'")'
+user_orgunit_children:'$encoder.jsEscape($i18n.getString( 'user_orgunit_children' ) , "'")',
+show_data:'$encoder.jsEscape($i18n.getString( 'show_data' ) , "'")'
 
 };
\ No newline at end of file