← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5828: (DV) Trend line (work in progress) + Improved code structure.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5828 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-01-30 21:20:10 +0100
message:
  (DV) Trend line (work in progress) + Improved code structure.
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_FR.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/app/css/style.css
  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	2012-01-25 17:26:58 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2012-01-30 13:51:10 +0000
@@ -21,9 +21,8 @@
 select_group=Select group
 data_elements=Data elements
 all_indicator_groups=[ All indicator groups ]
-available_indicators=Available indicators
-selected_indicators=Selected indicators
-available_data_elements=Available data elements
+available=Available
+selected=Selected
 periods=Periods
 months=Months
 last_month=Last month
@@ -88,4 +87,4 @@
 organisation_unit=Organisation unit
 invalid_uid=Invalid uid
 system_favorite_overwrite_not_allowed=* You are not allowed to overwrite a system favorite
-favorite_no_orgunits=Favorite has no organisation units
+favorite_no_orgunits=Favorite has no organisation units
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties	2012-01-20 04:31:05 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties	2012-01-30 13:51:10 +0000
@@ -21,9 +21,8 @@
 select_group=S\u00e9lectionner le goupe
 data_elements=Elements de donn\u00e9es
 all_indicator_groups=[ Tous les groupes d'indicateurs ]
-available_indicators=Indicateurs disponibles
-selected_indicators=Indicateurs s\u00e9lectionn\u00e9s
-available_data_elements=El\u00e9ments de donn\u00e9es disponibles
+available=Disponibles
+selected=S\u00e9lectionn\u00e9s
 periods=P\u00e9riodes
 months=Mois
 last_month=Dernier mois
@@ -45,8 +44,9 @@
 hide_subtitle=Masquer le sous-titre
 hide_legend=Masquer la l\u00e9gende
 user_orgunit=Unit\u00e9 d'organisation de l'utilisateur
-x_axis_label=Libell\u00e9 axe X
-y_axis_label=Libell\u00e9 axe Y
+domain_axis_label=Libell\u00e9 axe X
+range_axis_label=Libell\u00e9 axe Y
+target_line=Ligne cible
 target_line_value=Valeur de la ligne cible
 target_line_label=Libell\u00e9 de la ligne cible
 show_hide_chart_settings=Montrer/Masquer les param\u00e8tres du graphique
@@ -87,3 +87,4 @@
 organisation_unit=Unit\u00e9 d'organisation
 invalid_uid=uid invalide
 system_favorite_overwrite_not_allowed=* Vous n'\u00eates pas autoris\u00e9 \u00e0 \u00e9craser un favori du syst\u00e8me
+favorite_no_orgunits=Favoris n'a pas d'unit\u00e8s d'organisation
\ 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-01-27 12:37:21 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-01-30 20:15:40 +0000
@@ -1,21 +1,74 @@
 DV.conf = {
     init: {
-        data: [
-            {'domain_': 'Category 1', 'Series 1': 41, 'Series 2': 69, 'Series 3': 63, 'Series 4': 51},
-            {'domain_': 'Category 2', 'Series 1': 51, 'Series 2': 42, 'Series 3': 58, 'Series 4': 52},
-            {'domain_': 'Category 3', 'Series 1': 44, 'Series 2': 71, 'Series 3': 62, 'Series 4': 54}
-        ],
-        jsonfy: function(r) {
-            r = Ext.JSON.decode(r.responseText);
-            var obj = {system: {rootNode: {id: r.rn[0], name: r.rn[1], level: 1}, periods: {}, user: {id: r.user.id, isAdmin: r.user.isAdmin}}};
-            for (var relative in r.p) {
-                obj.system.periods[relative] = [];
-                for (var i = 0; i < r.p[relative].length; i++) {
-                    obj.system.periods[relative].push({id: r.p[relative][i][0], name: r.p[relative][i][1]});
-                }
-            }
-            return obj;
-        }
+		example: {
+			series: ['Series 1', 'Series 2', 'Series 3', 'Series 4'],
+			category: ['Category 1', 'Category 2', 'Category 3'],
+			filter: [DV.i18n.example_chart],
+			values: [51, 64, 48, 52, 72, 47, 66, 55, 62, 68, 63, 57],
+			setState: function() {
+				DV.state.type = DV.conf.finals.chart.column;
+				DV.state.series.dimension = DV.conf.finals.dimension.data.value;
+				DV.state.series.names = DV.conf.init.example.series;
+				DV.state.category.dimension = DV.conf.finals.dimension.period.value;
+				DV.state.category.names = DV.conf.init.example.category;
+				DV.state.filter.names = DV.conf.init.example.filter;
+				DV.state.targetLineValue = 90;
+				DV.state.rangeAxisLabel = 'Range axis label';
+			},
+			setValues: function() {
+				var obj1 = {}, obj2 = {}, obj3 = {}, obj4 = {}, obj5 = {}, obj6 = {}, obj7 = {}, obj8 = {}, obj9 = {}, obj10 = {}, obj11 = {}, obj12 = {};
+				obj1[DV.state.series.dimension] = DV.conf.init.example.series[0];
+				obj1[DV.state.category.dimension] = DV.conf.init.example.category[0];
+				obj1.v = DV.conf.init.example.values[0];
+				obj2[DV.state.series.dimension] = DV.conf.init.example.series[1];
+				obj2[DV.state.category.dimension] = DV.conf.init.example.category[0];
+				obj2.v = DV.conf.init.example.values[1];
+				obj3[DV.state.series.dimension] = DV.conf.init.example.series[2];
+				obj3[DV.state.category.dimension] = DV.conf.init.example.category[0];
+				obj3.v = DV.conf.init.example.values[2];
+				obj4[DV.state.series.dimension] = DV.conf.init.example.series[3];
+				obj4[DV.state.category.dimension] = DV.conf.init.example.category[0];
+				obj4.v = DV.conf.init.example.values[3];
+				obj5[DV.state.series.dimension] = DV.conf.init.example.series[0];
+				obj5[DV.state.category.dimension] = DV.conf.init.example.category[1];
+				obj5.v = DV.conf.init.example.values[4];
+				obj6[DV.state.series.dimension] = DV.conf.init.example.series[1];
+				obj6[DV.state.category.dimension] = DV.conf.init.example.category[1];
+				obj6.v = DV.conf.init.example.values[5];
+				obj7[DV.state.series.dimension] = DV.conf.init.example.series[2];
+				obj7[DV.state.category.dimension] = DV.conf.init.example.category[1];
+				obj7.v = DV.conf.init.example.values[6];
+				obj8[DV.state.series.dimension] = DV.conf.init.example.series[3];
+				obj8[DV.state.category.dimension] = DV.conf.init.example.category[1];
+				obj8.v = DV.conf.init.example.values[7];
+				obj9[DV.state.series.dimension] = DV.conf.init.example.series[0];
+				obj9[DV.state.category.dimension] = DV.conf.init.example.category[2];
+				obj9.v = DV.conf.init.example.values[8];
+				obj10[DV.state.series.dimension] = DV.conf.init.example.series[1];
+				obj10[DV.state.category.dimension] = DV.conf.init.example.category[2];
+				obj10.v = DV.conf.init.example.values[9];
+				obj11[DV.state.series.dimension] = DV.conf.init.example.series[2];
+				obj11[DV.state.category.dimension] = DV.conf.init.example.category[2];
+				obj11.v = DV.conf.init.example.values[10];
+				obj12[DV.state.series.dimension] = DV.conf.init.example.series[3];
+				obj12[DV.state.category.dimension] = DV.conf.init.example.category[2];
+				obj12.v = DV.conf.init.example.values[11];
+				DV.value.values = [obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11, obj12];
+			}
+		},
+		ajax: {
+			jsonfy: function(r) {
+				r = Ext.JSON.decode(r.responseText);
+				var obj = {system: {rootNode: {id: r.rn[0], name: r.rn[1], level: 1}, periods: {}, user: {id: r.user.id, isAdmin: r.user.isAdmin}}};
+				for (var relative in r.p) {
+					obj.system.periods[relative] = [];
+					for (var i = 0; i < r.p[relative].length; i++) {
+						obj.system.periods[relative].push({id: r.p[relative][i][0], name: r.p[relative][i][1]});
+					}
+				}
+				return obj;
+			}
+		}
     },
     finals: {
         ajax: {
@@ -74,7 +127,8 @@
         },
         data: {
 			domain: 'domain_',
-			targetline: 'targetline_'
+			targetline: 'targetline_',
+			trendline: 'trendline_'
 		},
         image: {
             png: 'png',
@@ -86,14 +140,12 @@
     },
     chart: {
         style: {
-            inset: 30
+            inset: 30,
+            font: 'arial,sans-serif,ubuntu,consolas'
         },
         theme: {
             dv1: ['#94ae0a', '#115fa6', '#a61120', '#ff8809', '#7c7474', '#a61187', '#ffd13e', '#24ad9a', '#a66111', '#414141', '#4500c4', '#1d5700']
-        },
-        axis: {
-			range: 1.1
-		}
+        }
     },
     layout: {
         west_width: 424,
@@ -129,10 +181,13 @@
         url: DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.initialize,
         success: function(r) {
             
-    DV.init = DV.conf.init.jsonfy(r);    
-    DV.init.initialize = function() {        
+    DV.init = DV.conf.init.ajax.jsonfy(r);
+    
+    DV.init.initialize = function() {
         DV.util.combobox.filter.category();
-        DV.chart.data = DV.conf.init.data;
+        
+        DV.conf.init.example.setState();
+        DV.conf.init.example.setValues();
         
         DV.init.cmd = DV.util.getUrlParam('uid') || DV.conf.finals.cmd.init;
         DV.exe.execute(true, DV.init.cmd);
@@ -313,14 +368,7 @@
                     }
                 }
                 return false;
-            },
-            getMaximum: function(store, keys) {
-				var maximum = 0;
-				for (var i = 0; i < keys.length; i++) {
-					maximum = store.max(keys[i]) > maximum ? store.max(keys[i]) : maximum;
-				}
-				return maximum;
-			}				
+            }		
         },
         dimension: {
             indicator: {
@@ -479,7 +527,7 @@
                         a.push(DV.util.string.getEncodedString(r.data.text));
                     });
                     if (exception && !a.length) {
-                        alert( DV.i18n.no_orgunits_selected );
+                        alert(DV.i18n.no_orgunits_selected);
                     }
                     return a;
                 },
@@ -495,7 +543,7 @@
                         a.push(DV.util.string.getEncodedString(r.data.id));
                     });
                     if (exception && !a.length) {
-                        alert( DV.i18n.no_orgunits_selected );
+                        alert(DV.i18n.no_orgunits_selected);
                     }
                     return a;
                 }                    
@@ -511,12 +559,24 @@
             }
         },
         chart: {
-			default: {				
+			default: {
+				getChart: function(axes, series) {
+					return Ext.create('Ext.chart.Chart', {
+						animate: true,
+						store: DV.store.chart,
+						insetPadding: DV.conf.chart.style.inset,
+						items: DV.state.hideSubtitle ? false : DV.util.chart.default.getTitle(),
+						legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(),
+						axes: axes,
+						series: series,
+						theme: 'dv1'
+					});
+				},
 				getLegend: function(len) {
 					len = len ? len : DV.store.chart.range.length;
 					return {
 						position: len > 5 ? 'right' : 'top',
-						labelFont: '15px arial',
+						labelFont: '15px ' + DV.conf.chart.style.font,
 						boxStroke: '#ffffff',
 						boxStrokeWidth: 0,
 						padding: 0
@@ -525,8 +585,8 @@
 				getTitle: function() {
 					return {
 						type: 'text',
-						text: DV.init.cmd === DV.conf.finals.cmd.init ? DV.i18n.example_chart : DV.state.filter.names[0],
-						font: 'bold 15px arial',
+						text: DV.state.filter.names[0],
+						font: 'bold 15px ' + DV.conf.chart.style.font,
 						fill: '#222',
 						width: 300,
 						height: 20,
@@ -537,7 +597,7 @@
 				label: {
 					getCategory: function() {
 						return {
-							font: '14px arial',
+							font: '14px ' + DV.conf.chart.style.font,
 							rotate: {
 								degrees: 330
 							}
@@ -545,32 +605,37 @@
 					},
 					getNumeric: function() {
 						return {
-							font: '13px arial',
+							font: '13px ' + DV.conf.chart.style.font,
 							renderer: Ext.util.Format.numberRenderer(DV.util.number.getChartAxisFormatRenderer())
 						};
 					}
 				},
 				axis: {
-					getGrid: function() {
-						return {
-							opacity: 1,
-							fill: '#f1f1f1',
-							stroke: '#aaa',
-							'stroke-width': 0.2
-						};
-					},
-					getNumeric: function() {
-						return {
+					getNumeric: function(stacked) {
+						var axis = {
 							type: 'Numeric',
 							position: 'left',
 							title: DV.state.rangeAxisLabel || false,
+							labelTitle: {
+								font: '17px ' + DV.conf.chart.style.font
+							},
 							minimum: 0,
-							fields: DV.store.chart.range,
+							fields: stacked ? DV.state.series.names : DV.store.chart.range,
 							label: DV.util.chart.default.label.getNumeric(),
 							grid: {
-								even: DV.util.chart.default.axis.getGrid()
+								even: {
+									opacity: 1,
+									fill: '#f1f1f1',
+									stroke: '#aaa',
+									'stroke-width': 0.2
+								}
 							}
 						};
+						if (DV.init.cmd === DV.conf.finals.cmd.init) {
+							axis.maximum = 100;
+							axis.majorTickSteps = 10;
+						}
+						return axis;
 					},
 					getCategory: function() {
 						return {
@@ -609,6 +674,23 @@
 							},
 							title: title
 						};
+					},
+					getTrendLine: function() {
+						return {
+							type: 'line',
+							axis: 'left',
+							xField: DV.conf.finals.data.domain,
+							yField: DV.conf.finals.data.trendline,
+							style: {
+								opacity: 1,
+								'stroke-width': 2
+							},
+							markerConfig: {
+								type: 'circle',
+								radius: 0
+							},
+							title: DV.i18n.trend_line + ' (' + DV.value.trendLine[0] + ' - ' + DV.value.trendLine[DV.value.trendLine.length - 1] + ')'
+						};
 					}
 				}
 			},
@@ -616,7 +698,7 @@
 				label: {
 					getCategory: function() {
 						return {
-							font: '14px arial'
+							font: '14px ' + DV.conf.chart.style.font
 						};
 					}
 				},
@@ -640,6 +722,13 @@
 						tl.xField = DV.conf.finals.data.targetline;
 						tl.yField = DV.conf.finals.data.domain;
 						return tl;
+					},
+					getTrendLine: function() {
+						var tl = DV.util.chart.default.series.getTrendLine();
+						tl.axis = 'bottom';
+						tl.xField = DV.conf.finals.data.trendline;
+						tl.yField = DV.conf.finals.data.domain;
+						return tl;
 					}
 				}
             },
@@ -647,12 +736,12 @@
 				series: {
 					getArray: function() {
 						var a = [];
-						for (var i = 0; i < DV.store.chart.range.length; i++) {
+						for (var i = 0; i < DV.state.series.names.length; i++) {
 							a.push({
 								type: 'line',
 								axis: 'left',
 								xField: DV.conf.finals.data.domain,
-								yField: DV.store.chart.range[i],
+								yField: DV.state.series.names[i],
 								style: {
 									opacity: 0.8,
 									'stroke-width': 3
@@ -673,7 +762,7 @@
                         {
                             type: 'text',
                             text: DV.state.filter.names[0],
-                            font: 'bold 15px arial',
+                            font: 'bold 15px ' + DV.conf.chart.style.font,
                             fill: '#222',
                             width: 300,
                             height: 20,
@@ -682,8 +771,8 @@
                         },
                         {
                             type: 'text',
-                            text: DV.store.chart.range[0],
-                            font: '13px arial',
+                            text: DV.state.series.names[0],
+                            font: '13px ' + DV.conf.chart.style.font,
                             fill: '#444',
                             width: 300,
                             height: 20,
@@ -699,7 +788,7 @@
 							height: 47,
 							renderer: function(item) {
 								this.setWidth((item.data[DV.conf.finals.data.domain].length * 8) + 15);
-								this.setTitle('<span class="dv-chart-tips">' + item.data[DV.conf.finals.data.domain] + '<br/><b>' + item.data[DV.store.chart.range[0]] + '</b></span>');
+								this.setTitle('<span class="dv-chart-tips">' + item.data[DV.conf.finals.data.domain] + '<br/><b>' + item.data[DV.state.series.names[0]] + '</b></span>');
 							}
 						};
 					}
@@ -795,11 +884,15 @@
         value: {
             jsonfy: function(r) {
                 r = Ext.JSON.decode(r.responseText);
-                var values = [];
+                var obj = {
+					values: [],
+					trendline: []
+				};
                 for (var i = 0; i < r.length; i++) {
-                    values.push({v: r[i][0], d: r[i][1], p: r[i][2], o: r[i][3]});
+                    obj.values.push({v: r[i][0], d: r[i][1], p: r[i][2], o: r[i][3]});
                 }
-                return values;
+                obj.trendline = [40,45,50,55,60,65,70,75,80,85,90,95];
+                return obj;
             }
         },
         crud: {
@@ -824,7 +917,7 @@
                     
                     var url = DV.cmp.favorite.system.getValue() ? DV.conf.finals.ajax.favorite_addorupdatesystem : DV.conf.finals.ajax.favorite_addorupdate;                    
                     Ext.Ajax.request({
-                        url: DV.conf.finals.ajax.path_visualizer + url,
+                        url: DV.conf.finals.ajax.path_visexecualizer + url,
                         params: params,
                         success: function() {
                             DV.store.favorite.load({callback: function() {
@@ -951,26 +1044,6 @@
                 data: []
             })
         },
-        datatable: null,
-        getDataTableStore: function(exe) {
-            this.datatable = Ext.create('Ext.data.Store', {
-                fields: [
-                    DV.conf.finals.dimension.data.value,
-                    DV.conf.finals.dimension.period.value,
-                    DV.conf.finals.dimension.organisationunit.value,
-                    'v'
-                ],
-                data: DV.value.values
-            });
-            
-            if (exe) {
-                DV.datatable.getDataTable(true);
-            }
-            else {
-                return this.datatable;
-            }
-            
-        },
         chart: null,
         getChartStore: function(exe) {
             var keys = [];
@@ -984,15 +1057,10 @@
             
             this.chart.range = keys.slice(0);
             for (var i = 0; i < this.chart.range.length; i++) {
-                if (this.chart.range[i] === DV.conf.finals.data.domain || this.chart.range[i] === DV.conf.finals.data.targetline) {
+                if (this.chart.range[i] === DV.conf.finals.data.domain) {
                     this.chart.range.splice(i, 1);
-                    i = 0;
                 }
             }
-                       
-            if (DV.state.targetLineValue) {
-				this.chart.maximum = DV.util.store.getMaximum(this.chart, this.chart.range);
-			}
             
             if (exe) {
                 DV.chart.getChart(true);
@@ -1001,6 +1069,26 @@
                 return this.chart;
             }
         },
+        datatable: null,
+        getDataTableStore: function(exe) {
+            this.datatable = Ext.create('Ext.data.Store', {
+                fields: [
+                    DV.conf.finals.dimension.data.value,
+                    DV.conf.finals.dimension.period.value,
+                    DV.conf.finals.dimension.organisationunit.value,
+                    'v'
+                ],
+                data: DV.value.values
+            });
+            
+            if (exe) {
+                DV.datatable.getDataTable(true);
+            }
+            else {
+                return this.datatable;
+            }
+            
+        },
         favorite: Ext.create('Ext.data.Store', {
             fields: ['id', 'name', 'lastUpdated', 'userId'],
             proxy: {
@@ -1037,15 +1125,15 @@
     DV.state = {
         type: DV.conf.finals.chart.column,
         series: {
-            dimension: DV.conf.finals.dimension.data.value,
+            dimension: null,
             names: []
         },
         category: {
-            dimension: DV.conf.finals.dimension.period.value,
+            dimension: null,
             names: []
         },
         filter: {
-            dimension: DV.conf.finals.dimension.organisationunit.value,
+            dimension: null,
             names: []
         },
         indicatorIds: [],
@@ -1056,8 +1144,9 @@
         hideLegend: false,
         domainAxisLabel: null,
         rangeAxisLabel: null,
-        targetLineValue: null,
+        targetLineValue: 70,
         targetLineLabel: null,
+        trendLine: null,
         isRendered: false,
         getState: function(exe) {
             this.resetState();
@@ -1093,6 +1182,7 @@
             
             this.hideSubtitle = DV.cmp.favorite.hidesubtitle.getValue();
             this.hideLegend = DV.cmp.favorite.hidelegend.getValue();
+            this.trendLine = DV.cmp.favorite.trendline.getValue();
             this.domainAxisLabel = DV.cmp.favorite.domainaxislabel.getValue();
             this.rangeAxisLabel = DV.cmp.favorite.rangeaxislabel.getValue();
             this.targetLineValue = parseFloat(DV.cmp.favorite.targetlinevalue.getValue());
@@ -1120,10 +1210,7 @@
             obj = Ext.Object.merge(obj, this.relativePeriods);
             return obj;            
         },
-        isBar: function() {
-			return this.type === DV.conf.finals.chart.bar || this.type === DV.conf.finals.chart.stackedbar;
-		},
-        setState: function(exe, uid) {
+        setFavorite: function(exe, uid) {
             if (uid) {
                 this.resetState();
                 Ext.Ajax.request({
@@ -1210,6 +1297,7 @@
                         this.category.names = f.names[this.category.dimension];
                         this.filter.names = f.names[this.filter.dimension];
                         
+                        this.trendLine = f.regression;
                         DV.cmp.favorite.trendline.setValue(f.regression);
                         this.hideSubtitle = f.hideSubtitle;
                         DV.cmp.favorite.hidesubtitle.setValue(f.hideSubtitle);
@@ -1250,7 +1338,13 @@
             this.dataelementIds = [];
             this.relativePeriods = {};
             this.organisationunitIds = [];
+			this.hideSubtitle = false,
             this.hideLegend = false;
+			this.trendLine = null;
+			this.domainAxisLabel = null;
+			this.rangeAxisLabel = null;
+			this.targetLineValue = null;
+			this.targetLineLabel = null;
         }
     };
     
@@ -1274,7 +1368,9 @@
             Ext.Ajax.request({
                 url: baseurl,
                 success: function(r) {
-                    DV.value.values = DV.util.value.jsonfy(r);
+					var json = DV.util.value.jsonfy(r);
+                    DV.value.values = json.values;
+                    DV.value.trendLine = json.trendline;
                     if (!DV.value.values.length) {
                         DV.mask.hide();
                         alert(DV.i18n.no_data);
@@ -1297,7 +1393,8 @@
                     }
                 }
             });
-        }
+        },
+        trendLine: []
     };
     
     DV.chart = {
@@ -1330,8 +1427,14 @@
 
 			if (DV.state.targetLineValue) {
 				Ext.Array.each(DV.chart.data, function(item) {
-					item[DV.conf.finals.data.targetline] = parseFloat(DV.state.targetLineValue);
+					item[DV.conf.finals.data.targetline] = DV.state.targetLineValue;
 				});
+			}			
+
+			if (DV.state.trendLine) {
+				for (var i = 0; i < DV.chart.data.length; i++) {
+					DV.chart.data[i][DV.conf.finals.data.trendline] = DV.value.trendLine[i];
+				}
 			}
             
             if (exe) {
@@ -1342,7 +1445,7 @@
             }
         },        
         chart: null,
-        getChart: function(exe) {
+        getChart: function(exe) {			
             this[DV.state.type]();
             if (exe) {
                 this.reload();
@@ -1357,7 +1460,7 @@
 				type: 'column',
 				axis: 'left',
 				xField: DV.conf.finals.data.domain,
-				yField: DV.store.chart.range,
+				yField: DV.state.series.names,
 				stacked: stacked,
 				style: {
 					opacity: 0.8
@@ -1366,25 +1469,16 @@
 			if (DV.state.targetLineValue && !stacked) {
 				series.push(DV.util.chart.default.series.getTargetLine());
 			}
+			if (DV.state.trendLine && !stacked) {
+				series.push(DV.util.chart.default.series.getTrendLine());
+			}
 			
 			var axes = [];
-			var numeric = DV.util.chart.default.axis.getNumeric();
-			if (DV.state.targetLineValue && DV.state.targetLineValue > DV.store.chart.maximum) {
-				numeric.maximum = Math.round(DV.state.targetLineValue * DV.conf.chart.axis.range);
-			}
+			var numeric = DV.util.chart.default.axis.getNumeric(stacked);
 			axes.push(numeric);
 			axes.push(DV.util.chart.default.axis.getCategory());
 			
-            this.chart = Ext.create('Ext.chart.Chart', {
-                animate: true,
-                store: DV.store.chart,
-                insetPadding: DV.conf.chart.style.inset,
-                items: DV.state.hideSubtitle ? false : DV.util.chart.default.getTitle(),
-                legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(),
-                axes: axes,
-                series: series,
-                theme: 'dv1'
-            });
+			this.chart = DV.util.chart.default.getChart(axes, series);
         },
         stackedcolumn: function() {
             this.column(true);
@@ -1395,7 +1489,7 @@
 				type: 'bar',
 				axis: 'bottom',
 				xField: DV.conf.finals.data.domain,
-				yField: DV.store.chart.range,
+				yField: DV.state.series.names,
 				stacked: stacked,
 				style: {
 					opacity: 0.8
@@ -1404,25 +1498,16 @@
 			if (DV.state.targetLineValue && !stacked) {
 				series.push(DV.util.chart.bar.series.getTargetLine());
 			}
+			if (DV.state.trendLine && !stacked) {
+				series.push(DV.util.chart.bar.series.getTrendLine());
+			}
 			
 			var axes = [];
-			var numeric = DV.util.chart.bar.axis.getNumeric();
-			if (DV.state.targetLineValue && DV.state.targetLineValue > DV.store.chart.maximum) {
-				numeric.maximum = Math.round(DV.state.targetLineValue * DV.conf.chart.axis.range);
-			}
+			var numeric = DV.util.chart.bar.axis.getNumeric(stacked);
 			axes.push(numeric);
 			axes.push(DV.util.chart.bar.axis.getCategory());
 			
-            this.chart = Ext.create('Ext.chart.Chart', {
-                animate: true,
-                store: DV.store.chart,
-                insetPadding: DV.conf.chart.style.inset,
-                items: DV.state.hideSubtitle ? false : DV.util.chart.default.getTitle(),
-                legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(),
-                axes: axes,
-                series: series,
-                theme: 'dv1'
-            });
+			this.chart = DV.util.chart.default.getChart(axes, series);
         },
         stackedbar: function() {
             this.bar(true);
@@ -1432,25 +1517,16 @@
 			if (DV.state.targetLineValue) {
 				series.push(DV.util.chart.default.series.getTargetLine());
 			}
+			if (DV.state.trendLine) {
+				series.push(DV.util.chart.default.series.getTrendLine());
+			}
 			
 			var axes = [];
 			var numeric = DV.util.chart.default.axis.getNumeric();
-			if (DV.state.targetLineValue && DV.state.targetLineValue > DV.store.chart.maximum) {
-				numeric.maximum = Math.round(DV.state.targetLineValue * DV.conf.chart.axis.range);
-			}
 			axes.push(numeric);
 			axes.push(DV.util.chart.default.axis.getCategory());
 			
-            this.chart = Ext.create('Ext.chart.Chart', {
-                animate: true,
-                store: DV.store.chart,
-                insetPadding: DV.conf.chart.style.inset,
-                items: DV.state.hideSubtitle ? false : DV.util.chart.default.getTitle(),
-                legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(),
-                axes: axes,
-                series: series,
-                theme: 'dv1'
-            });
+			this.chart = DV.util.chart.default.getChart(axes, series);
         },
         area: function() {
 			var series = [];
@@ -1458,7 +1534,7 @@
 				type: 'area',
 				axis: 'left',
 				xField: DV.conf.finals.data.domain,
-				yField: DV.store.chart.range,
+				yField: DV.state.series.names,
 				style: {
 					opacity: 0.65
 				}
@@ -1466,22 +1542,10 @@
 			
 			var axes = [];
 			var numeric = DV.util.chart.default.axis.getNumeric();
-			if (DV.state.targetLineValue && DV.state.targetLineValue > DV.store.chart.maximum) {
-				numeric.maximum = Math.round(DV.state.targetLineValue * DV.conf.chart.axis.range);
-			}
 			axes.push(numeric);
 			axes.push(DV.util.chart.default.axis.getCategory());
 			
-            this.chart = Ext.create('Ext.chart.Chart', {
-                animate: true,
-                store: DV.store.chart,
-                insetPadding: DV.conf.chart.style.inset,
-                items: DV.state.hideSubtitle ? false : DV.util.chart.default.getTitle(),
-                legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(),
-                axes: axes,
-                series: series,
-                theme: 'dv1'
-            });
+			this.chart = DV.util.chart.default.getChart(axes, series);
         },
         pie: function() {
             this.chart = Ext.create('Ext.chart.Chart', {
@@ -1493,7 +1557,7 @@
                 legend: DV.state.hideLegend ? false : DV.util.chart.default.getLegend(DV.state.category.names.length),
                 series: [{
                     type: 'pie',
-                    field: DV.store.chart.range[0],
+                    field: DV.state.series.names[0],
                     showInLegend: true,
                     tips: DV.util.chart.pie.series.getTips(),
                     label: {
@@ -1580,10 +1644,10 @@
         execute: function(exe, cmd) {
             if (cmd) {
                 if (cmd === DV.conf.finals.cmd.init) {
-                    DV.store.getChartStore(exe);
+                    DV.chart.getData(exe);
                 }
                 else {
-                    DV.state.setState(true, cmd);
+                    DV.state.setFavorite(true, cmd);
                 }
             }
             else {
@@ -1858,7 +1922,7 @@
                                                 tbar: [
                                                     {
                                                         xtype: 'label',
-                                                        text: DV.i18n.available_indicators,
+                                                        text: DV.i18n.available,
                                                         cls: 'dv-toolbar-multiselect-left-label'
                                                     },
                                                     '->',
@@ -1923,7 +1987,7 @@
                                                     '->',
                                                     {
                                                         xtype: 'label',
-                                                        text: DV.i18n.selected_indicators,
+                                                        text: DV.i18n.selected,
                                                         cls: 'dv-toolbar-multiselect-right-label'
                                                     }
                                                 ],
@@ -2019,7 +2083,7 @@
                                                 tbar: [
                                                     {
                                                         xtype: 'label',
-                                                        text: DV.i18n.available_data_elements,
+                                                        text: DV.i18n.available,
                                                         cls: 'dv-toolbar-multiselect-left-label'
                                                     },
                                                     '->',
@@ -2084,7 +2148,7 @@
                                                     '->',
                                                     {
                                                         xtype: 'label',
-                                                        text: DV.i18n.selected_data_elements,
+                                                        text: DV.i18n.selected,
                                                         cls: 'dv-toolbar-multiselect-right-label'
                                                     }
                                                 ],

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css	2012-01-19 14:32:10 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css	2012-01-30 14:32:22 +0000
@@ -411,11 +411,11 @@
 /* Multiselect docked bar font size */
 .dv-toolbar-multiselect-left .dv-toolbar-multiselect-left-label {
     font-size: 11px;
-    padding-left: 5px;
+    padding-left: 6px;
 }
 .dv-toolbar-multiselect-right .dv-toolbar-multiselect-right-label {
     font-size: 11px;
-    padding-right: 5px;
+    padding-right: 7px;
 }
 
 /* Multiselect boundlist */

=== 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-01-25 17:26:58 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-01-30 13:51:10 +0000
@@ -1,13 +1,13 @@
 DV.i18n = {
-title: '$encoder.jsEscape($i18n.getString( 'title' ) , "'")',
-chart_type: '$encoder.jsEscape($i18n.getString( 'chart_type' ) , "'")',
-column_chart: '$encoder.jsEscape($i18n.getString( 'column_chart' ) , "'")',
+title:'$encoder.jsEscape($i18n.getString( 'title' ) , "'")',
+chart_type:'$encoder.jsEscape($i18n.getString( 'chart_type' ) , "'")',
+column_chart:'$encoder.jsEscape($i18n.getString( 'column_chart' ) , "'")',
 stacked_column_chart: '$encoder.jsEscape($i18n.getString( 'stacked_column_chart' ) , "'")',
-bar_chart:  '$encoder.jsEscape($i18n.getString( 'bar_chart' ) , "'")',
+bar_chart:'$encoder.jsEscape($i18n.getString( 'bar_chart' ) , "'")',
 stacked_bar_chart: '$encoder.jsEscape($i18n.getString( 'stacked_bar_chart' ) , "'")',
-line_chart:    '$encoder.jsEscape($i18n.getString( 'line_chart' ) , "'")',
-area_chart:   '$encoder.jsEscape($i18n.getString( 'line_chart' ) , "'")',
-pie_chart:   '$encoder.jsEscape($i18n.getString( 'pie_chart' ) , "'")',
+line_chart:'$encoder.jsEscape($i18n.getString( 'line_chart' ) , "'")',
+area_chart:'$encoder.jsEscape($i18n.getString( 'line_chart' ) , "'")',
+pie_chart:'$encoder.jsEscape($i18n.getString( 'pie_chart' ) , "'")',
 series: '$encoder.jsEscape($i18n.getString( 'series' ) , "'")' ,
 category:'$encoder.jsEscape($i18n.getString( 'category' ) , "'")',
 filter:'$encoder.jsEscape($i18n.getString( 'filter' ) , "'")',
@@ -22,9 +22,8 @@
 select_group:'$encoder.jsEscape($i18n.getString( 'select_group' ) , "'")',
 data_elements:'$encoder.jsEscape($i18n.getString( 'data_elements' ) , "'")',
 all_indicator_groups:'$encoder.jsEscape($i18n.getString( 'all_indicator_groups' ) , "'")',
-available_indicators:'$encoder.jsEscape($i18n.getString( 'available_indicators' ) , "'")',
-selected_indicators:'$encoder.jsEscape($i18n.getString( 'selected_indicators' ) , "'")',
-available_data_elements:'$encoder.jsEscape($i18n.getString( 'available_data_elements' ) , "'")',
+available:'$encoder.jsEscape($i18n.getString( 'available' ) , "'")',
+selected:'$encoder.jsEscape($i18n.getString( 'selected' ) , "'")',
 periods:'$encoder.jsEscape($i18n.getString( 'periods' ) , "'")',
 months:'$encoder.jsEscape($i18n.getString( 'months' ) , "'")',
 last_month:'$encoder.jsEscape($i18n.getString( 'last_month' ) , "'")',