← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16686: DV show values option respected for gauge charts.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16686 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-09-10 16:21:51 +0200
message:
  DV show values option respected for gauge charts.
modified:
  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-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2014-09-10 11:56:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2014-09-10 13:31:39 +0000
@@ -2829,7 +2829,7 @@
                         legend,
                         config,
                         chart;
-
+                        
                     axis = {
                         type: 'gauge',
                         position: 'gauge',
@@ -2845,7 +2845,7 @@
                         //donut: 5,
                         colorSet: ['#82B525', '#ddd']
                     };
-
+                    
                     chart = getDefaultChart({
                         axes: [axis],
                         series: [series],
@@ -2860,6 +2860,17 @@
                         }
                     });
 
+                    if (xLayout.showValues) {
+                        chart.items.push(Ext.create('Ext.draw.Sprite', {
+                            type: 'text',
+                            text: store.getRange()[0].data[columnIds[0]],
+                            font: 'normal 26px ' + conf.chart.style.fontFamily,
+                            fill: '#111',
+                            height: 40,
+                            y: 	60
+                        }));
+                    }
+
                     chart.setChartSize = function() {
 						this.animate = false;
                         this.setWidth(ns.app.centerRegion.getWidth());
@@ -2870,11 +2881,21 @@
                     chart.setTitlePosition = function() {
                         if (this.items) {
                             var title = this.items[0],
-                                titleX = (ns.app.centerRegion.getWidth() / 2) - (title.el.getWidth() / 2);
-
-                            title.setAttributes({
-                                x: titleX
-                            }, true);
+                                subTitle = this.items[1];
+
+                            if (title) {
+                                var titleX = (ns.app.centerRegion.getWidth() / 2) - (title.el.getWidth() / 2);
+                                title.setAttributes({
+                                    x: titleX
+                                }, true);
+                            }
+
+                            if (subTitle) {
+                                var subTitleX = (ns.app.centerRegion.getWidth() / 2) - (subTitle.el.getWidth() / 2);
+                                subTitle.setAttributes({
+                                    x: subTitleX
+                                }, true);
+                            }
                         }
                     };