dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17356
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6868: Updated DV plugin. Moved permanently to web api.
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 6868 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-05-06 21:29:06 +0200
message:
Updated DV plugin. Moved permanently to web api.
removed:
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesPluginAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValuesPlugin.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/ChartPluginValue.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.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-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2012-03-22 12:34:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2012-05-06 18:55:26 +0000
@@ -28,6 +28,7 @@
*/
import java.util.Collection;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -86,4 +87,12 @@
* @return the count of objects.
*/
int getCountByName( String name );
+
+ /**
+ * Retrieves a list of objects referenced by the given collection of uids.
+ *
+ * @param uids a collection of uids.
+ * @return a list of objects.
+ */
+ List<T> getByUid( Collection<String> uids );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2012-03-28 12:26:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2012-05-06 18:55:26 +0000
@@ -157,7 +157,7 @@
* @param uids the collection of uids.
* @return a collection of DataElements.
*/
- Set<DataElement> getDataElementsByUid( Collection<String> uids );
+ List<DataElement> getDataElementsByUid( Collection<String> uids );
/**
* Returns all DataElements with types that are possible to aggregate. The
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2012-03-28 12:26:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2012-05-06 18:55:26 +0000
@@ -28,7 +28,7 @@
*/
import java.util.Collection;
-import java.util.Set;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -56,7 +56,7 @@
Collection<Indicator> getIndicators( Collection<Integer> identifiers );
- Set<Indicator> getIndicatorsByUid( Collection<String> uids );
+ List<Indicator> getIndicatorsByUid( Collection<String> uids );
Indicator getIndicatorByName( String name );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2012-03-28 12:26:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2012-05-06 18:55:26 +0000
@@ -139,7 +139,7 @@
* @param uids the collection of uids.
* @return a collection of OrganisationUnits.
*/
- Set<OrganisationUnit> getOrganisationUnitsByUid( Collection<String> uids );
+ List<OrganisationUnit> getOrganisationUnitsByUid( Collection<String> uids );
/**
* Returns an OrganisationUnit with a given name.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-04-24 13:28:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-05-06 18:55:26 +0000
@@ -143,16 +143,9 @@
} );
}
- public Set<DataElement> getDataElementsByUid( Collection<String> uids )
+ public List<DataElement> getDataElementsByUid( Collection<String> uids )
{
- Set<DataElement> dataElements = new HashSet<DataElement>();
-
- for ( String uid : uids )
- {
- dataElements.add( dataElementStore.getByUid( uid ) );
- }
-
- return dataElements;
+ return dataElementStore.getByUid( uids );
}
public void setZeroIsSignificantForDataElements( Collection<Integer> dataElementIds )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2012-03-28 12:26:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2012-05-06 18:55:26 +0000
@@ -27,13 +27,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.i18n.I18nUtils.*;
+import static org.hisp.dhis.i18n.I18nUtils.getCountByName;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsByName;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
-import java.util.Set;
+import java.util.List;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.i18n.I18nService;
@@ -135,16 +138,9 @@
} );
}
- public Set<Indicator> getIndicatorsByUid( Collection<String> uids )
+ public List<Indicator> getIndicatorsByUid( Collection<String> uids )
{
- Set<Indicator> indicators = new HashSet<Indicator>();
-
- for ( String uid : uids )
- {
- indicators.add( indicatorStore.getByUid( uid ) );
- }
-
- return indicators;
+ return indicatorStore.getByUid( uids );
}
public Indicator getIndicatorByName( String name )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-04-23 09:49:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-05-06 18:55:26 +0000
@@ -180,16 +180,9 @@
} );
}
- public Set<OrganisationUnit> getOrganisationUnitsByUid( Collection<String> uids )
+ public List<OrganisationUnit> getOrganisationUnitsByUid( Collection<String> uids )
{
- Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
- for ( String uid : uids )
- {
- organisationUnits.add( organisationUnitStore.getByUid( uid ) );
- }
-
- return organisationUnits;
+ return organisationUnitStore.getByUid( uids );
}
public OrganisationUnit getOrganisationUnit( String uid )
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2012-03-16 06:36:41 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2012-05-06 18:55:26 +0000
@@ -27,11 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.Set;
import org.hisp.dhis.api.mobile.IProgramService;
@@ -53,8 +50,6 @@
private org.hisp.dhis.program.ProgramService programService;
- private org.hisp.dhis.i18n.I18nService i18nService;
-
private org.hisp.dhis.mobile.service.ModelMapping modelMapping;
// -------------------------------------------------------------------------
@@ -109,8 +104,6 @@
public Program getProgram( int programId, String localeString )
{
- Locale locale = LocaleUtil.getLocale( localeString );
-
org.hisp.dhis.program.Program program = programService.getProgram( programId );
//program = i18n( i18nService, locale, program );
@@ -168,12 +161,6 @@
}
@Required
- public void setI18nService( org.hisp.dhis.i18n.I18nService i18nService )
- {
- this.i18nService = i18nService;
- }
-
- @Required
public void setModelMapping( org.hisp.dhis.mobile.service.ModelMapping modelMapping )
{
this.modelMapping = modelMapping;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-04-20 08:30:53 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-05-06 18:55:26 +0000
@@ -29,7 +29,6 @@
<bean id="org.hisp.dhis.mobile.api.IProgramService" class="org.hisp.dhis.mobile.service.DefaultProgramService">
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
<property name="modelMapping" ref="org.hisp.dhis.mobile.service.ModelMapping" />
</bean>
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2012-02-10 11:48:09 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2012-05-06 18:55:26 +0000
@@ -39,6 +39,7 @@
import org.springframework.beans.factory.annotation.Required;
import org.springframework.jdbc.core.JdbcTemplate;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -312,4 +313,17 @@
criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) );
return ((Number) criteria.uniqueResult()).intValue();
}
+
+ @Override
+ public List<T> getByUid( Collection<String> uids )
+ {
+ List<T> list = new ArrayList<T>();
+
+ for ( String uid : uids )
+ {
+ list.add( getByUid( uid ) );
+ }
+
+ return list;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java 2012-05-05 18:56:51 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java 2012-05-06 19:28:22 +0000
@@ -1,17 +1,42 @@
package org.hisp.dhis.api.controller;
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_JSON;
import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
import static org.hisp.dhis.system.util.DateUtils.setNames;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.aggregation.AggregatedDataValue;
import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
@@ -20,7 +45,6 @@
import org.hisp.dhis.api.webdomain.ChartPluginValue;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.indicator.Indicator;
@@ -78,20 +102,31 @@
I18nFormat format = i18nManager.getI18nFormat();
List<Period> periods = periodService.reloadPeriods( setNames( relativePeriods.getRelativePeriods(), format ) );
-
- List<Integer> periodIds = new ArrayList<Integer>( getIdentifiers( Period.class, periods ) );
-
- chartValue.setP( periodIds );
-
- Set<OrganisationUnit> organisationUnits = organisationUnitService
- .getOrganisationUnitsByUid( organisationUnitIds );
-
+
+ for ( Period period : periods )
+ {
+ chartValue.getPeriods().add( period.getName() );
+ }
+
+ List<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsByUid( organisationUnitIds );
+
+ for ( OrganisationUnit unit : organisationUnits )
+ {
+ chartValue.getOrgUnits().add( unit.getName() );
+ }
+
if ( indicatorIds != null )
{
- Set<Indicator> indicators = indicatorService.getIndicatorsByUid( indicatorIds );
+ List<Indicator> indicators = indicatorService.getIndicatorsByUid( indicatorIds );
+ for ( Indicator indicator : indicators )
+ {
+ chartValue.getData().add( indicator.getDisplayShortName() );
+ }
+
Collection<AggregatedIndicatorValue> indicatorValues = aggregatedDataValueService.getAggregatedIndicatorValues(
- getIdentifiers( Indicator.class, indicators ), periodIds,
+ getIdentifiers( Indicator.class, indicators ),
+ getIdentifiers( Period.class, periods ),
getIdentifiers( OrganisationUnit.class, organisationUnits ) );
for ( AggregatedIndicatorValue value : indicatorValues )
@@ -99,20 +134,26 @@
String[] record = new String[4];
record[0] = String.valueOf( value.getValue() );
- record[1] = indicatorService.getIndicator( value.getIndicatorId() ).getShortName();
+ record[1] = indicatorService.getIndicator( value.getIndicatorId() ).getDisplayShortName();
record[2] = format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) );
record[3] = organisationUnitService.getOrganisationUnit( value.getOrganisationUnitId() ).getName();
- chartValue.getV().add( record );
+ chartValue.getValues().add( record );
}
}
if ( dataElementIds != null )
{
- Set<DataElement> dataElements = dataElementService.getDataElementsByUid( dataElementIds );
+ List<DataElement> dataElements = dataElementService.getDataElementsByUid( dataElementIds );
+
+ for ( DataElement element : dataElements )
+ {
+ chartValue.getData().add( element.getDisplayShortName() );
+ }
Collection<AggregatedDataValue> dataValues = aggregatedDataValueService.getAggregatedDataValueTotals(
- getIdentifiers( DataElement.class, dataElements ), periodIds,
+ getIdentifiers( DataElement.class, dataElements ),
+ getIdentifiers( Period.class, periods ),
getIdentifiers( OrganisationUnit.class, organisationUnits ) );
for ( AggregatedDataValue value : dataValues )
@@ -120,11 +161,11 @@
String[] record = new String[4];
record[0] = String.valueOf( value.getValue() );
- record[1] = dataElementService.getDataElement( value.getDataElementId() ).getShortName();
+ record[1] = dataElementService.getDataElement( value.getDataElementId() ).getDisplayShortName();
record[2] = format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) );
record[3] = organisationUnitService.getOrganisationUnit( value.getOrganisationUnitId() ).getName();
- chartValue.getV().add( record );
+ chartValue.getValues().add( record );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/ChartPluginValue.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/ChartPluginValue.java 2012-05-05 16:46:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/ChartPluginValue.java 2012-05-06 18:55:26 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.api.webdomain;
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.util.ArrayList;
import java.util.List;
@@ -11,29 +38,55 @@
@JacksonXmlRootElement( localName = "dxf2", namespace = Dxf2Namespace.NAMESPACE )
public class ChartPluginValue
{
- private List<String[]> v = new ArrayList<String[]>();
-
- private List<Integer> p = new ArrayList<Integer>();
-
- @JsonProperty
- public List<String[]> getV()
- {
- return v;
- }
-
- public void setV( List<String[]> v )
- {
- this.v = v;
- }
-
- @JsonProperty
- public List<Integer> getP()
- {
- return p;
- }
-
- public void setP( List<Integer> p )
- {
- this.p = p;
+ private List<String[]> values = new ArrayList<String[]>();
+
+ private List<String> periods = new ArrayList<String>();
+
+ private List<String> data = new ArrayList<String>();
+
+ private List<String> orgUnits = new ArrayList<String>();
+
+ @JsonProperty( value = "v" )
+ public List<String[]> getValues()
+ {
+ return values;
+ }
+
+ public void setValues( List<String[]> values )
+ {
+ this.values = values;
+ }
+
+ @JsonProperty( value = "p" )
+ public List<String> getPeriods()
+ {
+ return periods;
+ }
+
+ public void setPeriods( List<String> periods )
+ {
+ this.periods = periods;
+ }
+
+ @JsonProperty( value = "d" )
+ public List<String> getData()
+ {
+ return data;
+ }
+
+ public void setData( List<String> data )
+ {
+ this.data = data;
+ }
+
+ @JsonProperty( value = "o" )
+ public List<String> getOrgUnits()
+ {
+ return orgUnits;
+ }
+
+ public void setOrgUnits( List<String> orgUnits )
+ {
+ this.orgUnits = orgUnits;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2012-05-05 18:56:19 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2012-05-06 19:28:22 +0000
@@ -54,9 +54,10 @@
DHIS.store.pie = DHIS.store.defaultChartStore;
DHIS.getChart = DHIS.exe.addToQueue;
+ DHIS.destroyChart = DHIS.exe.destroy;
};
- DHIS.projects = [];
+ DHIS.projects = {};
DHIS.util = {
dimension: {
@@ -161,7 +162,7 @@
trackMouse: true,
style: 'border-width:2px; background-color:#eee',
renderer: function(r, item) {
- this.update('<span style="font-size:22px">' + item.value[1] + '</span>');
+ this.update('<span style="font-size:21px">' + '' + item.value[1] + '</span>');
}
};
},
@@ -204,6 +205,10 @@
axis: 'left',
xField: project.store.bottom,
yField: project.store.left[i],
+ style: {
+ opacity: 0.8,
+ lineWidth: 3
+ },
tips: DHIS.util.chart.getTips()
});
}
@@ -282,7 +287,9 @@
jsonfy: function(r) {
var object = {
values: [],
- periods: r.p
+ periods: r.p,
+ datanames: [],
+ organisationunitnames: []
};
for (var i = 0; i < r.v.length; i++) {
var obj = {};
@@ -292,6 +299,12 @@
obj[DHIS.conf.finals.dimension.organisationunit.value] = r.v[i][3];
object.values.push(obj);
}
+ for (var j = 0; j < r.d.length; j++) {
+ object.datanames.push(DHIS.util.string.getEncodedString(r.d[j]));
+ }
+ for (var k = 0; k < r.o.length; k++) {
+ object.organisationunitnames.push(DHIS.util.string.getEncodedString(r.o[k]));
+ }
return object;
}
}
@@ -303,9 +316,11 @@
},
defaultChartStore: function(project) {
var keys = [];
+
Ext.Array.each(project.data, function(item) {
keys = Ext.Array.merge(keys, Ext.Object.getKeys(item));
});
+
project.store = Ext.create('Ext.data.Store', {
fields: keys,
data: project.data
@@ -375,6 +390,10 @@
project.state.conf.category = project.state.conf.category.toLowerCase();
project.state.conf.filter = project.state.conf.filter.toLowerCase();
+ project.state.conf[project.state.conf.series] = DHIS.conf.finals.chart.series;
+ project.state.conf[project.state.conf.category] = DHIS.conf.finals.chart.category;
+ project.state.conf[project.state.conf.filter] = DHIS.conf.finals.chart.filter;
+
project.state.type = project.state.conf.type;
project.state.series.dimension = project.state.conf.series;
project.state.category.dimension = project.state.conf.category;
@@ -414,7 +433,8 @@
}
});
}
- }
+ },
+ storage: {}
};
DHIS.value = {
@@ -445,12 +465,12 @@
project.values[i][DHIS.conf.finals.dimension.data.value] = DHIS.util.string.getEncodedString(project.values[i][DHIS.conf.finals.dimension.data.value]);
project.values[i][DHIS.conf.finals.dimension.period.value] = DHIS.util.string.getEncodedString(project.values[i][DHIS.conf.finals.dimension.period.value]);
project.values[i][DHIS.conf.finals.dimension.organisationunit.value] = DHIS.util.string.getEncodedString(project.values[i][DHIS.conf.finals.dimension.organisationunit.value]);
- }
+ }
- Ext.Array.each(project.values, function(item) {
- Ext.Array.include(project.state.series.names, DHIS.util.string.getEncodedString(item[project.state.series.dimension]));
- Ext.Array.include(project.state.category.names, DHIS.util.string.getEncodedString(item[project.state.category.dimension]));
- Ext.Array.include(project.state.filter.names, DHIS.util.string.getEncodedString(item[project.state.filter.dimension]));
+ project.state[project.state.conf.data].names = json.datanames;
+ project.state[project.state.conf.organisationunit].names = json.organisationunitnames;
+ Ext.Array.each(project.values, function(item) {
+ Ext.Array.include(project.state[project.state.conf.period].names, DHIS.util.string.getEncodedString(item[project.state[project.state.conf.period].dimension]));
item.v = parseFloat(item.v);
});
@@ -503,7 +523,7 @@
this[project.state.type](project);
DHIS.exe.execute();
},
- column: function(project, isStacked) {
+ column: function(project, isStacked) {
project.chart = Ext.create('Ext.chart.Chart', {
renderTo: project.state.conf.el,
width: project.state.conf.width || this.el.getWidth(),
@@ -537,15 +557,16 @@
xField: project.store.bottom,
yField: project.store.left,
stacked: isStacked,
- style: {
- opacity: 0.8
- },
+ style: {
+ opacity: 0.8,
+ stroke: '#333'
+ },
tips: DHIS.util.chart.getTips()
}
]
});
- DHIS.projects.push(project);
+ DHIS.projects[project.state.conf.el] = project;
},
stackedcolumn: function(project) {
this.column(project, true);
@@ -584,15 +605,16 @@
xField: project.store.left,
yField: project.store.bottom,
stacked: isStacked,
- style: {
- opacity: 0.8
- },
+ style: {
+ opacity: 0.8,
+ stroke: '#333'
+ },
tips: DHIS.util.chart.getTips()
}
]
});
- DHIS.projects.push(project);
+ DHIS.projects[project.state.conf.el] = project;
},
stackedbar: function(project) {
this.bar(project, true);
@@ -627,7 +649,7 @@
series: DHIS.util.chart.line.getSeriesArray(project)
});
- DHIS.projects.push(project);
+ DHIS.projects[project.state.conf.el] = project;
},
area: function(project) {
project.chart = Ext.create('Ext.chart.Chart', {
@@ -661,13 +683,14 @@
axis: 'left',
xField: project.store.bottom[0],
yField: project.store.left,
- style: {
- opacity: 0.65
- }
+ style: {
+ opacity: 0.65,
+ stroke: '#555'
+ }
}]
});
- DHIS.projects.push(project);
+ DHIS.projects[project.state.conf.el] = project;
},
pie: function(project) {
project.chart = Ext.create('Ext.chart.Chart', {
@@ -693,13 +716,14 @@
}
},
style: {
- opacity: 0.9
+ opacity: 0.9,
+ stroke: '#555'
},
tips: DHIS.util.chart.pie.getTips(project.store.left[0])
}]
});
- DHIS.projects.push(project);
+ DHIS.projects[project.state.conf.el] = project;
}
};
@@ -707,7 +731,7 @@
allow: true,
queue: [],
addToQueue: function(conf) {
- DHIS.exe.queue.push(conf);
+ DHIS.exe.queue.push(conf);
if (DHIS.exe.allow) {
DHIS.exe.allow = false;
DHIS.exe.execute();
@@ -716,6 +740,7 @@
execute: function() {
if (this.queue.length) {
var conf = this.queue.shift();
+ this.destroy(conf.el);
if (conf.uid) {
DHIS.state.setState(conf);
}
@@ -723,6 +748,14 @@
DHIS.state.getState(conf);
}
}
+ else {
+ DHIS.exe.allow = true;
+ }
+ },
+ destroy: function(el) {
+ if (DHIS.projects[el]) {
+ DHIS.projects[el].chart.destroy();
+ }
}
};
=== removed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesPluginAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesPluginAction.java 2012-05-06 01:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesPluginAction.java 1970-01-01 00:00:00 +0000
@@ -1,337 +0,0 @@
-package org.hisp.dhis.visualizer.action;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_JSON;
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.aggregation.AggregatedDataValue;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
-import org.hisp.dhis.api.utils.ContextUtils;
-import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Jan Henrik Overland
- */
-public class GetAggregatedValuesPluginAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private AggregatedDataValueService aggregatedDataValueService;
-
- public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
- {
- this.aggregatedDataValueService = aggregatedDataValueService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- @Autowired
- private ContextUtils contextUtils;
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Collection<String> indicatorIds;
-
- public void setIndicatorIds( Collection<String> indicatorIds )
- {
- this.indicatorIds = indicatorIds;
- }
-
- private Collection<String> dataElementIds;
-
- public void setDataElementIds( Collection<String> dataElementIds )
- {
- this.dataElementIds = dataElementIds;
- }
-
- private Collection<String> organisationUnitIds;
-
- public void setOrganisationUnitIds( Collection<String> organisationUnitIds )
- {
- this.organisationUnitIds = organisationUnitIds;
- }
-
- private boolean lastMonth;
-
- public void setLastMonth( boolean lastMonth )
- {
- this.lastMonth = lastMonth;
- }
-
- private boolean last12Months;
-
- public void setLast12Months( boolean last12Months )
- {
- this.last12Months = last12Months;
- }
-
- private boolean lastQuarter;
-
- public void setLastQuarter( boolean lastQuarter )
- {
- this.lastQuarter = lastQuarter;
- }
-
- private boolean last4Quarters;
-
- public void setLast4Quarters( boolean last4Quarters )
- {
- this.last4Quarters = last4Quarters;
- }
-
- private boolean lastSixMonth;
-
- public void setLastSixMonth( boolean lastSixMonth )
- {
- this.lastSixMonth = lastSixMonth;
- }
-
- private boolean last2SixMonths;
-
- public void setLast2SixMonths( boolean last2SixMonths )
- {
- this.last2SixMonths = last2SixMonths;
- }
-
- private boolean thisYear;
-
- public void setThisYear( boolean thisYear )
- {
- this.thisYear = thisYear;
- }
-
- private boolean last5Years;
-
- public void setLast5Years( boolean last5Years )
- {
- this.last5Years = last5Years;
- }
-
- public String callback;
-
- public String getCallback()
- {
- return callback;
- }
-
- public void setCallback( String callback )
- {
- this.callback = callback;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private Collection<AggregatedIndicatorValue> indicatorValues = new HashSet<AggregatedIndicatorValue>();
-
- public Collection<AggregatedIndicatorValue> getIndicatorValues()
- {
- return indicatorValues;
- }
-
- private Collection<AggregatedDataValue> dataValues = new HashSet<AggregatedDataValue>();
-
- public Collection<AggregatedDataValue> getDataValues()
- {
- return dataValues;
- }
-
- private List<Period> periods;
-
- public List<Period> getPeriods()
- {
- return periods;
- }
-
- private Collection<String> dataNames = new ArrayList<String>();
-
- public Collection<String> getDataNames()
- {
- return dataNames;
- }
-
- private Collection<String> organisationUnitNames = new ArrayList<String>();
-
- public Collection<String> getOrganisationUnitNames()
- {
- return organisationUnitNames;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- private List<Period> setNames( List<Period> periods )
- {
- for ( Period period : periods )
- {
- period.setName( format.formatPeriod( period ) );
- }
-
- return periods;
- }
-
- public String execute()
- throws Exception
- {
- if ( organisationUnitIds != null
- && (lastMonth || last12Months || lastQuarter || last4Quarters || lastSixMonth || last2SixMonths || thisYear || last5Years) )
- {
- RelativePeriods rp = new RelativePeriods();
- rp.setReportingMonth( lastMonth );
- rp.setLast12Months( last12Months );
- rp.setReportingQuarter( lastQuarter );
- rp.setLast4Quarters( last4Quarters );
- rp.setLastSixMonth( lastSixMonth );
- rp.setLast2SixMonths( last2SixMonths );
- rp.setThisYear( thisYear );
- rp.setLast5Years( last5Years );
-
- periods = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
- Collection<Integer> periodIds = getIdentifiers( Period.class, periods );
-
- Set<OrganisationUnit> organisationUnits = organisationUnitService
- .getOrganisationUnitsByUid( organisationUnitIds );
-
- for ( String id : organisationUnitIds )
- {
- organisationUnitNames.add( organisationUnitService.getOrganisationUnit( id ).getName() );
- }
-
- if ( indicatorIds != null )
- {
- Set<Indicator> indicators = indicatorService.getIndicatorsByUid( indicatorIds );
-
- indicatorValues = aggregatedDataValueService.getAggregatedIndicatorValues(
- getIdentifiers( Indicator.class, indicators ), periodIds,
- getIdentifiers( OrganisationUnit.class, organisationUnits ) );
-
- for ( AggregatedIndicatorValue value : indicatorValues )
- {
- value.setIndicatorName( indicatorService.getIndicator( value.getIndicatorId() ).getShortName() );
- value.setPeriodName( format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) ) );
- value.setOrganisationUnitName( organisationUnitService.getOrganisationUnit(
- value.getOrganisationUnitId() ).getName() );
- }
-
- for ( String id : indicatorIds )
- {
- dataNames.add( indicatorService.getIndicator( id ).getDisplayShortName() );
- }
- }
-
- if ( dataElementIds != null )
- {
- Set<DataElement> dataElements = dataElementService.getDataElementsByUid( dataElementIds );
-
- dataValues = aggregatedDataValueService.getAggregatedDataValueTotals( getIdentifiers( DataElement.class, dataElements ), periodIds,
- getIdentifiers( OrganisationUnit.class, organisationUnits ) );
-
- for ( AggregatedDataValue value : dataValues )
- {
- value.setDataElementName( dataElementService.getDataElement( value.getDataElementId() )
- .getShortName() );
- value.setPeriodName( format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) ) );
- value.setOrganisationUnitName( organisationUnitService.getOrganisationUnit(
- value.getOrganisationUnitId() ).getName() );
- }
-
- for ( String id : dataElementIds )
- {
- dataNames.add( dataElementService.getDataElement( id ).getDisplayShortName() );
- }
- }
- }
-
- contextUtils.configureResponse( ServletActionContext.getResponse(), CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING, null, false );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 13:36:44 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2012-05-06 19:28:22 +0000
@@ -41,18 +41,6 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</bean>
- <bean id="org.hisp.dhis.visualizer.action.GetAggregatedValuesPluginAction"
- class="org.hisp.dhis.visualizer.action.GetAggregatedValuesPluginAction"
- scope="prototype">
- <property name="aggregatedDataValueService"
- ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- </bean>
-
<!-- Chart -->
<bean id="org.hisp.dhis.visualizer.action.AddOrUpdateChartAction"
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2012-04-26 13:55:41 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2012-05-06 19:28:22 +0000
@@ -41,14 +41,6 @@
/dhis-web-visualizer/void.vm</result>
</action>
- <action name="getAggregatedValuesPlugin"
- class="org.hisp.dhis.visualizer.action.GetAggregatedValuesPluginAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminAggregatedValuesPlugin.vm</result>
- <result name="none" type="velocity-json">
- /dhis-web-visualizer/void.vm</result>
- </action>
-
<!-- Chart -->
<action name="addOrUpdateSystemChart"
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html 2012-05-06 01:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html 2012-05-06 19:28:22 +0000
@@ -1,19 +1,40 @@
<html>
<head>
- <link rel="stylesheet" type="text/css" href="../../../dhis-web-commons/javascripts/ext/resources/css/ext-all-gray.css" />
<script type="text/javascript" src="../../../dhis-web-commons/javascripts/ext/ext-all.js"></script>
- <script type="text/javascript" src="plugin.js"></script>
+ <script type="text/javascript" src="../../../dhis-web-commons/javascripts/plugin/chart.js"></script>
<style>
body {margin: 0 0 0 60px;}
h1 {font-size: 20px; margin: 20px 0;}
- #chart1 {width: 900px; height: 400px; border: 2px solid #d1d1d1; margin-bottom: 100px; border-radius: 4px}
+ #chart1 {width: 900px; height: 400px; border: 2px solid #d1d1d1; margin-bottom: 100px; border-radius: 3px;}
- #chart2 {width: 1200px; height: 400px; border: 2px solid #d1d1d1; margin-bottom: 100px;}
+ #chart2 {width: 1200px; height: 400px; border: 2px solid #d1d1d1; margin-bottom: 100px; border-radius: 3px;}
</style>
+ <script>
+ Ext.onReady( function() {
+ var url = '../../../'; // http://apps.dhis2.org/dev/
+
+ DHIS.getChart({
+ uid: 'EbRN2VIbPdV',
+ el: 'chart1',
+ url: url
+ });
+
+ DHIS.getChart({
+ type: 'stackedcolumn',
+ indicators: ['Uvn6LCg7dVU', 'OdiHJayrsKo'],
+ periods: 'last12Months',
+ organisationunits: ['ImspTQPwCqd'],
+ el: 'chart2',
+ url: url
+ });
+
+ });
+ </script>
+
<!--
CONFIG TYPE DEFAULT DESCRIPTION
@@ -41,27 +62,5 @@
<h1>My chart 2</h1>
<div id="chart2"></div>
-
- <script>
- Ext.onReady( function() {
- var url = '../../../'; // http://apps.dhis2.org/dev/
-
- DHIS.getChart({
- uid: 'EbRN2VIbPdV',
- el: 'chart1',
- url: url
- });
-
- DHIS.getChart({
- type: 'stackedcolumn',
- indicators: ['Uvn6LCg7dVU', 'OdiHJayrsKo'],
- periods: 'last12Months',
- organisationunits: ['ImspTQPwCqd'],
- el: 'chart2',
- url: url
- });
-
- });
- </script>
</body>
</html>
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js 2012-05-06 01:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js 2012-05-06 19:28:22 +0000
@@ -2,7 +2,7 @@
DHIS.conf = {
finals: {
ajax: {
- data_get: 'dhis-web-visualizer/getAggregatedValuesPlugin.action',
+ data_get: 'api/chartValues.jsonp',
favorite_get: 'api/charts/'
},
dimension: {
=== removed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValuesPlugin.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValuesPlugin.vm 2012-05-06 01:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValuesPlugin.vm 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-#set( $indicatorSize = $indicatorValues.size() )#set( $dataSize = $dataValues.size() )#set( $periodSize = $periods.size() )#set( $dataNamesSize = $dataNames.size() )#set( $organisationUnitNamesSize = $organisationUnitNames.size() )
-${callback}({"v":[#if( $indicatorSize > 0 )#foreach( $iv in $indicatorValues )["$!{iv.value}","$!{iv.indicatorName}","$!{iv.periodName}","$!{iv.organisationUnitName}"]#if( $velocityCount < $indicatorSize ),#end#end#end#if( $dataSize > 0 )#if( $indicatorSize > 0 ),#end#foreach( $dv in $dataValues )["$!{dv.value}","$!{dv.dataElementName}","$!{dv.periodName}","$!{dv.organisationUnitName}"]#if( $velocityCount < $dataSize ),#end#end#end],"p":[#foreach($p in $periods)"$!encoder.jsonEncode(${p.name})"#if($velocityCount<$periodSize),#end#end],"d":[#foreach($dn in $dataNames)"$!encoder.jsonEncode(${dn})"#if($velocityCount<$dataNamesSize),#end#end],"o":[#foreach($oun in $organisationUnitNames)"$!encoder.jsonEncode(${oun})"#if($velocityCount<$organisationUnitNamesSize),#end#end]})
\ No newline at end of file