← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5530: Minor fix

 

------------------------------------------------------------
revno: 5530
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-21 23:16:32 +0100
message:
  Minor fix
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java


--
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-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-21 20:41:22 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2011-12-21 22:16:32 +0000
@@ -786,167 +786,6 @@
         return new CategoryDataset[] { regularDataSet, regressionDataSet };
     }
     
-    /**
-     * Returns a DefaultCategoryDataSet based on aggregated data for the chart.
-     */
-    /*
-    private CategoryDataset[] getCategoryDataSet( Chart chart )
-    {
-        boolean realTimeAggregation = systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
-            DEFAULT_AGGREGATION_STRATEGY ).equals( AGGREGATION_STRATEGY_REAL_TIME );
-
-        final DefaultCategoryDataset regularDataSet = new DefaultCategoryDataset();
-        final DefaultCategoryDataset regressionDataSet = new DefaultCategoryDataset();
-
-        if ( chart != null )
-        {
-            Period selectedPeriod = chart.getAllPeriods().get( 0 );
-            OrganisationUnit selectedOrganisationUnit = chart.getAllOrganisationUnits().get( 0 );
-
-            List<Indicator> indicators = chart.getIndicators();
-            List<DataElement> dataElements = chart.getDataElements();
-            List<DataSet> dataSets = chart.getDataSets();
-
-            boolean indicatorChart = isIndicatorChart( chart );
-            boolean dataElementChart = isDataElementChart( chart );
-            boolean completenessChart = isCompletenessChart( chart );
-
-            int loopSize = indicators.size();
-
-            if ( dataElementChart )
-            {
-                loopSize = dataElements.size();
-            }
-            else if ( completenessChart )
-            {
-                loopSize = dataSets.size();
-            }
-
-            for ( int i = 0; i < loopSize; i++ )
-            {
-                final SimpleRegression regression = new SimpleRegression();
-
-                int columnIndex = 0;
-
-                String shortName = null;
-
-                if ( indicatorChart )
-                {
-                    shortName = indicators.get( i ).getShortName();
-                }
-                else if ( dataElementChart )
-                {
-                    shortName = dataElements.get( i ).getShortName();
-                }
-
-                if ( hasPeriodDimension( chart ) )
-                {
-                    // ---------------------------------------------------------
-                    // Regular dataset
-                    // ---------------------------------------------------------
-
-                    for ( Period period : chart.getAllPeriods() )
-                    {
-                        Double value = null;
-
-                        if ( indicatorChart )
-                        {
-                            value = realTimeAggregation ?
-                                aggregationService.getAggregatedIndicatorValue( indicators.get( i ), period.getStartDate(), period.getEndDate(), selectedOrganisationUnit ) :
-                                aggregatedDataValueService.getAggregatedValue( indicators.get( i ), period, selectedOrganisationUnit );
-                        }
-                        else if ( dataElementChart )
-                        {
-                            value = realTimeAggregation ?
-                                aggregationService.getAggregatedDataValue( dataElements.get( i ), null, period.getStartDate(), period.getEndDate(), selectedOrganisationUnit ) :
-                                aggregatedDataValueService.getAggregatedValue( dataElements.get( i ), period, selectedOrganisationUnit );
-                        }
-
-                        // categorydataset: value - series - category
-                        
-                        if ( chart.isDimension( DIMENSION_PERIOD_INDICATOR ) // if category is PERIOD
-                            || chart.isDimension( DIMENSION_PERIOD_DATAELEMENT ) )
-                        {
-                            regularDataSet.addValue( value != null ? value : 0, shortName, chart.getFormat()
-                                .formatPeriod( period ) );
-                        }
-                        else // if category is DATA
-                        {
-                            regularDataSet.addValue( value != null ? value : 0,
-                                chart.getFormat().formatPeriod( period ), shortName );
-                        }
-
-                        columnIndex++;
-
-                        // Omit missing values and 0 from regression
-
-                        if ( value != null && value != 0.0 )
-                        {
-                            regression.addData( columnIndex, value );
-                        }
-                    }
-
-                    // ---------------------------------------------------------
-                    // Regression dataset
-                    // ---------------------------------------------------------
-
-                    columnIndex = 0;
-
-                    if ( chart.isRegression() ) // Regression only when category is PERIOD
-                    {
-                        for ( Period period : chart.getAllPeriods() )
-                        {
-                            final double value = regression.predict( columnIndex++ );
-
-                            // Enough values must exist for regression
-
-                            if ( !Double.isNaN( value ) )
-                            {
-                                regressionDataSet.addValue( value, TREND_PREFIX + shortName, chart.getFormat()
-                                    .formatPeriod( period ) );
-
-                            }
-                        }
-                    }
-                }
-                else if ( chart.isDimension( DIMENSION_ORGANISATIONUNIT_INDICATOR ) // if category is ORG UNIT
-                    || chart.isDimension( DIMENSION_ORGANISATIONUNIT_DATAELEMENT ) )
-                {
-                    // ---------------------------------------------------------
-                    // Regular dataset
-                    // ---------------------------------------------------------
-
-                    for ( OrganisationUnit unit : chart.getAllOrganisationUnits() )
-                    {
-                        Double value = null;
-
-                        if ( indicatorChart )
-                        {
-                            value = realTimeAggregation ?
-                                aggregationService.getAggregatedIndicatorValue( indicators.get( i ), selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), unit ) :
-                                aggregatedDataValueService.getAggregatedValue( indicators.get( i ), selectedPeriod, unit );
-                        }
-                        else if ( dataElementChart )
-                        {
-                            value = realTimeAggregation ?
-                                aggregationService.getAggregatedDataValue( dataElements.get( i ), null, selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), unit ) :
-                                aggregatedDataValueService.getAggregatedValue( dataElements.get( i ), selectedPeriod, unit );
-                        }
-
-                        regularDataSet.addValue( value != null ? value : 0, shortName, unit.getShortName() );
-
-                        columnIndex++;
-                    }
-
-                    // Regression not relevant for organisation unit category
-                }
-
-            }
-        }
-
-        return new CategoryDataset[]{regularDataSet, regressionDataSet};
-    }*/
-
     private TextTitle getSubTitle( Chart chart )
     {
         TextTitle title = new TextTitle();