dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07255
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2047: (GIS) Label string bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2047 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-09-03 15:58:38 +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
--
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 09:31:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-09-03 10:26:18 +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;
}
@@ -143,22 +141,7 @@
function sortByValue(a,b){return b.value-a.value;}
/* Create JSON for map export */
function getExportDataValueJSON(mapvalues){var json='{';json+='"datavalues":';json+='[';mapvalues.sort(sortByValue);for(var i=0;i<mapvalues.length;i++){json+='{';json+='"organisation": "'+mapvalues[i].orgUnitId+'",';json+='"value": "'+mapvalues[i].value+'" ';json+=i<mapvalues.length-1?'},':'}'}json+=']';json+='}';return json}
-
-function getLegendsJSON(){
- var legends=choropleth.imageLegend;
- var json='{';
- json+='"legends":';
- json+='[';
- for(var i=0;i<choropleth.imageLegend.length;i++){
- json+='{';
- json+='"label": "'+choropleth.imageLegend[i].label+'",';
- json+='"color": "'+choropleth.imageLegend[i].color+'" ';
- json+=i<choropleth.imageLegend.length-1?'},':'}';
- }
- json+=']';
- json+='}';
- return json;
-}
+function getLegendsJSON(){var legends=choropleth.imageLegend;var json='{';json+='"legends":';json+='[';for(var i=0;i<choropleth.imageLegend.length;i++){json+='{';json+='"label": "'+choropleth.imageLegend[i].label+'",';json+='"color": "'+choropleth.imageLegend[i].color+'" ';json+=i<choropleth.imageLegend.length-1?'},':'}'}json+=']';json+='}';return json}
Ext.onReady( function() {
Ext.BLANK_IMAGE_URL = '../resources/ext/resources/images/default/s.gif';
@@ -617,19 +600,8 @@
}
if (vcb && dcb && mcb && lcb) {
- var svgChildren = document.getElementById('_OpenLayers_Container').childNodes;
- var svgDivId = null;
-
- for ( i=0; i<svgChildren.length; i++ ) { // Search for div containing SVG
- var svgDivId = svgChildren[i].getAttribute('id');
- if ( svgDivId && svgDivId.indexOf( 'OpenLayers.Layer.Vector_' ) != -1 ) {
- break;
- }
- }
-
- var svg = document.getElementById(svgDivId).innerHTML;
- var objectSVGDocument = document.getElementById(svgDivId).childNodes[0];
-
+ var svg = document.getElementById('OpenLayers.Layer.Vector_17').innerHTML;
+ var objectSVGDocument = document.getElementById('OpenLayers.Layer.Vector_17').childNodes[0];
var viewBox = objectSVGDocument.getAttribute('viewBox');
var title = Ext.getCmp('exportimagetitle_tf').getValue();
@@ -3639,7 +3611,7 @@
zoomInButton,
zoomOutButton,
zoomMaxExtentButton,
- '-',
+ // '-',
exportImageButton,
// exportExcelButton,
'-',
=== 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 10:26:18 +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,14 @@
}
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) + ')';
+ }
}
}