=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-01-20 15:20:41 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-01-20 19:11:15 +0000 @@ -3917,6 +3917,7 @@ extendInstance, createViewport, initialize, + dimConf, ns = { core: {}, app: {} @@ -4070,7 +4071,42 @@ var xResponse, xColAxis, xRowAxis, - config; + config, + ind = ns.core.conf.finals.dimension.indicator.objectName, + legendSet, + fn; + + fn = function() { + + // create chart + ns.app.chart = ns.core.web.chart.createChart(ns, legendSet); + + // fade + if (!ns.skipFade && ns.core.init.el && Ext.get(ns.core.init.el)) { + ns.app.chart.on('afterrender', function() { + Ext.defer( function() { + Ext.get(ns.core.init.el).fadeIn({ + duration: 400 + }); + }, 300 ); + }); + } + + // update viewport + ns.app.centerRegion.removeAll(); + ns.app.centerRegion.add(ns.app.chart); + + if (!ns.skipMask) { + web.mask.hide(ns.app.centerRegion); + } + + if (DV.isDebug) { + console.log('layout', ns.app.layout); + console.log('xLayout', ns.app.xLayout); + console.log('response', ns.app.response); + console.log('xResponse', ns.app.xResponse); + } + }; if (!xLayout) { xLayout = service.layout.getExtendedLayout(layout); @@ -4085,33 +4121,21 @@ ns.app.response = response; ns.app.xResponse = xResponse; - if (DV.isDebug) { - console.log('layout', ns.app.layout); - console.log('xLayout', ns.app.xLayout); - console.log('response', ns.app.response); - console.log('xResponse', ns.app.xResponse); - } - - // create chart - ns.app.chart = ns.core.web.chart.createChart(ns); - - // fade - if (!ns.skipFade && ns.core.init.el && Ext.get(ns.core.init.el)) { - ns.app.chart.on('afterrender', function() { - Ext.defer( function() { - Ext.get(ns.core.init.el).fadeIn({ - duration: 400 - }); - }, 300 ); + // legend set + if (xLayout.type === 'gauge' && Ext.Array.contains(xLayout.axisObjectNames, ind) && xLayout.objectNameIdsMap[ind].length) { + Ext.Ajax.request({ + url: ns.core.init.contextPath + '/api/indicators/' + xLayout.objectNameIdsMap[ind][0] + '.json?fields=legendSet[mapLegends[id,name,startValue,endValue,color]]', + disableCaching: false, + success: function(r) { + legendSet = Ext.decode(r.responseText).legendSet; + }, + callback: function() { + fn(); + } }); } - - // update viewport - ns.app.centerRegion.removeAll(); - ns.app.centerRegion.add(ns.app.chart); - - if (!ns.skipMask) { - web.mask.hide(ns.app.centerRegion); + else { + fn(); } }; }; === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-01-19 16:07:50 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-01-20 19:11:15 +0000 @@ -3314,7 +3314,16 @@ } }); - init.legendSets = []; + // legend sets + requests.push({ + url: init.contextPath + '/api/mapLegendSets.json?fields=id,name,mapLegends[id,name,startValue,endValue,color]&paging=false', + success: function(r) { + init.legendSets = Ext.decode(r.responseText).mapLegendSets || []; + fn(); + } + }); + + //init.legendSets = []; for (var i = 0; i < requests.length; i++) { if (type === 'jsonp') { === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-01-20 16:23:39 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-01-20 19:11:15 +0000 @@ -3001,6 +3001,7 @@ } }); + // user orgunit requests.push({ url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false', disableCaching: false, @@ -3010,7 +3011,16 @@ } }); - init.legendSets = []; + // legend sets + requests.push({ + url: init.contextPath + '/api/mapLegendSets.json?fields=id,name,mapLegends[id,name,startValue,endValue,color]&paging=false', + success: function(r) { + init.legendSets = Ext.decode(r.responseText).mapLegendSets || []; + fn(); + } + }); + + //init.legendSets = []; for (var i = 0; i < requests.length; i++) { if (type === 'jsonp') {