← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2049: (GIS) Label string bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2049 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-09-03 18:31:16 +0530
message:
  (GIS) Label string bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.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-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-03 11:09:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-03 12:26:57 +0000
@@ -70,12 +70,10 @@
 function toggleFeatureLabelsPolygons(layer) {
     function activateLabels() {
         layer.styleMap = getActivatedOpenLayersStyleMap(MAPDATA[thematicMap].nameColumn);
-        layer.refresh();
         LABELS[thematicMap] = true;
     }
     function deactivateLabels() {
         layer.styleMap = getDeactivatedOpenLayersStyleMap();
-        layer.refresh();
         LABELS[thematicMap] = false;
     }
     

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-09-02 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-09-03 12:59:16 +0000
@@ -1533,7 +1533,10 @@
                             if (mapvalues[i].orgUnitName == FEATURE[thematicMap][j].attributes.name) {
                                 FEATURE[thematicMap][j].attributes.value = parseFloat(mapvalues[i].value);
                                 if (!FEATURE[thematicMap][j].attributes.labelString) {
-                                    FEATURE[thematicMap][j].attributes.labelString = FEATURE[thematicMap][j].attributes.name + ' (' + FEATURE[thematicMap][j].attributes.value.toFixed(1) + ')';
+                                    FEATURE[thematicMap][j].attributes.labelString = FEATURE[thematicMap][j].attributes.name;
+                                    if (Ext.isNumber(FEATURE[thematicMap][j].attributes.value)) {
+                                        FEATURE[thematicMap][j].attributes.labelString += ' (' + FEATURE[thematicMap][j].attributes.value.toFixed(1) + ')';
+                                    }
                                 }
                                 break;
                             }
@@ -1628,9 +1631,13 @@
                                     }
 
                                     for (var j = 0; j < FEATURE[thematicMap].length; j++) {
-                                        FEATURE[thematicMap][j].attributes.value = mv[mour[FEATURE[thematicMap][j].attributes[nameColumn]]] || 0;
+                                        var value = mv[mour[FEATURE[thematicMap][j].attributes[nameColumn]]];
+                                        FEATURE[thematicMap][j].attributes.value = value ? parseFloat(value) : '';
                                         if (!FEATURE[thematicMap][j].attributes.labelString) {
-                                            FEATURE[thematicMap][j].attributes.labelString = FEATURE[thematicMap][j].attributes[nameColumn] + ' (' + FEATURE[thematicMap][j].attributes.value.toFixed(1) + ')';
+                                            FEATURE[thematicMap][j].attributes.labelString = FEATURE[thematicMap][j].attributes[nameColumn];
+                                            if (Ext.isNumber(FEATURE[thematicMap][j].attributes.value)) {
+                                                FEATURE[thematicMap][j].attributes.labelString += ' (' + FEATURE[thematicMap][j].attributes.value.toFixed(1) + ')';
+                                            }
                                         }
                                     }
                                     

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2010-09-02 12:48:17 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2010-09-03 12:59:16 +0000
@@ -1533,7 +1533,10 @@
                             if (mapvalues[i].orgUnitName == FEATURE[thematicMap2][j].attributes.name) {
                                 FEATURE[thematicMap2][j].attributes.value = parseFloat(mapvalues[i].value);
                                 if (!FEATURE[thematicMap2][j].attributes.labelString) {
-                                    FEATURE[thematicMap2][j].attributes.labelString = FEATURE[thematicMap2][j].attributes.name + ' (' + FEATURE[thematicMap2][j].attributes.value.toFixed(1) + ')';
+                                    FEATURE[thematicMap2][j].attributes.labelString = FEATURE[thematicMap2][j].attributes.name;
+                                    if (Ext.isNumber(FEATURE[thematicMap2][j].attributes.value)) {
+                                        FEATURE[thematicMap2][j].attributes.labelString += ' (' + FEATURE[thematicMap2][j].attributes.value.toFixed(1) + ')';
+                                    }
                                 }
                                 break;
                             }
@@ -1628,9 +1631,13 @@
                                     }
 
                                     for (var j = 0; j < FEATURE[thematicMap2].length; j++) {
-                                        FEATURE[thematicMap2][j].attributes.value = mv[mour[FEATURE[thematicMap2][j].attributes[nameColumn]]] || 0;
+                                        var value = mv[mour[FEATURE[thematicMap2][j].attributes[nameColumn]]];
+                                        FEATURE[thematicMap2][j].attributes.value = value ? parseFloat(value) : '';
                                         if (!FEATURE[thematicMap2][j].attributes.labelString) {
-                                            FEATURE[thematicMap2][j].attributes.labelString = FEATURE[thematicMap2][j].attributes[nameColumn] + ' (' + FEATURE[thematicMap2][j].attributes.value.toFixed(1) + ')';
+                                            FEATURE[thematicMap2][j].attributes.labelString = FEATURE[thematicMap2][j].attributes[nameColumn];
+                                            if (Ext.isNumber(FEATURE[thematicMap2][j].attributes.value)) {
+                                                FEATURE[thematicMap2][j].attributes.labelString += ' (' + FEATURE[thematicMap2][j].attributes.value.toFixed(1) + ')';
+                                            }
                                         }
                                     }