dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15372
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5548: Chart, minor fix
------------------------------------------------------------
revno: 5548
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-22 17:01:28 +0100
message:
Chart, minor fix
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GenerateChartAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-22 14:06:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-22 16:01:28 +0000
@@ -49,6 +49,7 @@
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -226,18 +227,19 @@
if ( DIMENSION_DATA.equals( dimension ) )
{
- list.addAll( getDataElements() );
- list.addAll( getIndicators() );
+ list.addAll( dataElements );
+ list.addAll( indicators );
}
else if ( DIMENSION_PERIOD.equals( dimension ) )
{
namePeriods( getRelativePeriods(), format );
- list.addAll( getRelativePeriods() );
+ list.addAll( relativePeriods );
}
else if ( DIMENSION_ORGANISATIONUNIT.equals( dimension ) )
{
- list.addAll( getAllOrganisationUnits() );
+ list.addAll( organisationUnits );
+ list.addAll( organisationUnit != null ? Arrays.asList( organisationUnit ) : new ArrayList<NameableObject>() );
}
return list;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java 2011-12-21 11:59:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java 2011-12-22 16:01:28 +0000
@@ -59,7 +59,7 @@
JFreeChart getJFreeOrganisationUnitChart( Indicator indicator, OrganisationUnit parent, boolean title, I18nFormat format );
- JFreeChart getJFreeChart( List<Indicator> indicators, List<DataElement> dataElements, List<DataSet> dataSets, List<Period> periods,
+ JFreeChart getJFreeChart( List<Indicator> indicators, List<DataElement> dataElements, List<Period> periods,
List<OrganisationUnit> organisationUnits, String series, String category, String filter, boolean regression, I18nFormat format );
JFreeChart getJFreeChart( String name, PlotOrientation orientation, CategoryLabelPositions labelPositions,
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-12-22 15:07:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-12-22 16:01:28 +0000
@@ -288,7 +288,7 @@
}
public JFreeChart getJFreeChart( List<Indicator> indicators, List<DataElement> dataElements,
- List<DataSet> dataSets, List<Period> periods, List<OrganisationUnit> organisationUnits,
+ List<Period> periods, List<OrganisationUnit> organisationUnits,
String series, String category, String filter,
boolean regression, I18nFormat format )
{
@@ -300,7 +300,6 @@
chart.setRegression( regression );
chart.setIndicators( indicators );
chart.setDataElements( dataElements );
- chart.setDataSets( dataSets );
chart.setRelativePeriods( periods );
chart.setOrganisationUnits( organisationUnits );
chart.setFormat( format );
@@ -759,7 +758,7 @@
regularDataSet.addValue( value, series.getShortName(), category.getShortName() );
- if ( chart.isRegression() && !MathUtils.isEqual( value, MathUtils.ZERO ) )
+ if ( chart.isRegression() && value != null && !MathUtils.isEqual( value, MathUtils.ZERO ) )
{
regression.addData( categoryIndex, value );
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GenerateChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GenerateChartAction.java 2011-12-21 20:06:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GenerateChartAction.java 2011-12-22 16:01:28 +0000
@@ -35,8 +35,6 @@
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
@@ -81,13 +79,6 @@
this.dataElementService = dataElementService;
}
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
private PeriodService periodService;
public void setPeriodService( PeriodService periodService )
@@ -120,18 +111,11 @@
this.indicatorId = indicatorId;
}
- private List<String> dataElementsId;
-
- public void setDataElementsId( List<String> dataElementsId )
- {
- this.dataElementsId = dataElementsId;
- }
-
- private List<String> selectedDataSets = new ArrayList<String>();
-
- public void setSelectedDataSets( List<String> selectedDataSets )
- {
- this.selectedDataSets = selectedDataSets;
+ private List<String> dataElementId;
+
+ public void setDataElementId( List<String> dataElementId )
+ {
+ this.dataElementId = dataElementId;
}
private List<String> periodId;
@@ -224,18 +208,11 @@
List<DataElement> dataElements = new ArrayList<DataElement>();
- for ( Integer id : getIntegerCollection( dataElementsId ) )
+ for ( Integer id : getIntegerCollection( dataElementId ) )
{
dataElements.add( dataElementService.getDataElement( id ) );
}
- List<DataSet> dataSets = new ArrayList<DataSet>();
-
- for ( Integer id : getIntegerCollection( selectedDataSets ) )
- {
- dataSets.add( dataSetService.getDataSet( id ) );
- }
-
List<Period> periods = new ArrayList<Period>();
for ( String id : periodId )
@@ -254,7 +231,7 @@
height = 500;
- chart = chartService.getJFreeChart( indicators, dataElements, dataSets, periods, organisationUnits,
+ chart = chartService.getJFreeChart( indicators, dataElements, periods, organisationUnits,
series, category, filter, regression, format );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-12-22 13:09:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-12-22 16:01:28 +0000
@@ -48,7 +48,6 @@
<property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js 2011-09-07 11:00:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js 2011-12-22 16:01:28 +0000
@@ -47,7 +47,8 @@
if ( organisationUnitId == -1 )
{
setHeaderDelayMessage( i18n_selected_organisation_unit );
- } else
+ }
+ else
{
clearGlobalVariables();
@@ -142,25 +143,28 @@
if ( chartIndicators == "single" && chartDimension == "period" )
{
- url += "?indicatorId=" + currentIndicator + "&organisationUnitId=" + currentOrgunit
- + "&dimension=period®ression=true";
+ url += "?indicatorId=" + currentIndicator + "&organisationUnitId=" + currentOrgunit +
+ "&series=DATA&category=PERIOD&filter=ORGANISATIONUNIT®ression=true"
for ( p in periods )
{
url += "&periodId=" + periods[p].id;
}
- } else if ( chartIndicators == "single" && chartDimension == "orgunit" )
+ }
+ else if ( chartIndicators == "single" && chartDimension == "orgunit" )
{
- url += "?indicatorId=" + currentIndicator + "&periodId=" + currentPeriod
- + "&dimension=organisationUnit®ression=false";
+ url += "?indicatorId=" + currentIndicator + "&periodId=" + currentPeriod +
+ "&series=DATA&category=ORGANISATIONUNIT&filter=PERIOD";
for ( o in orgunits )
{
url += "&organisationUnitId=" + orgunits[o].id;
}
- } else if ( chartIndicators == "all" && chartDimension == "period" )
+ }
+ else if ( chartIndicators == "all" && chartDimension == "period" )
{
- url += "?organisationUnitId=" + currentOrgunit + "&dimension=period®ression=false&chartWidth=950";
+ url += "?organisationUnitId=" + currentOrgunit +
+ "&series=DATA&category=PERIOD&filter=ORGANISATIONUNIT&chartWidth=950®ression=true";
for ( i in indicators )
{
@@ -173,9 +177,11 @@
}
chartWidth = 1000;
- } else if ( chartIndicators == "all" && chartDimension == "orgunit" )
+ }
+ else if ( chartIndicators == "all" && chartDimension == "orgunit" )
{
- url += "?periodId=" + currentPeriod + "&dimension=organisationUnit®ression=false&chartWidth=950";
+ url += "?periodId=" + currentPeriod +
+ "&series=DATA&category=ORGANISATIONUNIT&filter=PERIOD&chartWidth=950";
for ( i in indicators )
{