← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18053: Dashboard, event chart legend names issue fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18053 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-19 17:35:02 +0100
message:
  Dashboard, event chart legend names issue fixed.
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.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-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js	2015-01-15 23:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js	2015-01-19 16:34:04 +0000
@@ -3091,7 +3091,7 @@
                     else {
                         for (var i = 0, id, name, mxl, ids; i < store.rangeFields.length; i++) {
                             id = failSafeColumnIdMap[store.rangeFields[i]];
-                            name = xResponse.metaData.names[id];
+                            name = xResponse.metaData.optionNames[id] || xResponse.metaData.names[id];
 
                             if (Ext.isString(name) && Ext.isObject(xLayout.legendStyle) && Ext.isNumber(xLayout.legendStyle.labelMaxLength)) {
                                 var mxl = parseInt(xLayout.legendStyle.labelMaxLength);
@@ -3113,11 +3113,9 @@
                         return xLayout.legendStyle.labelNames;
                     }
                     else {
-                        var id = store.domainFields[0],
-                            name;
-
-                        store.each( function(r) {
-                            name = r.data[id];
+                        for (var i = 0, id, name; i < rowIds.length; i++) {
+                            id = rowIds[i];
+                            name = xResponse.metaData.optionNames[id] || xResponse.metaData.names[id];
 
                             if (Ext.isString(name) && Ext.isObject(xLayout.legendStyle) && Ext.isNumber(xLayout.legendStyle.labelMaxLength)) {
                                 var mxl = parseInt(xLayout.legendStyle.labelMaxLength);
@@ -3126,7 +3124,7 @@
                             }
 
                             a.push(name);
-                        });
+                        }
                     }
 
                     return a;