← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1994: Applied patch from Tran, work in progress in indicator chart

 

------------------------------------------------------------
revno: 1994
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Sat 2010-08-28 12:44:15 +0200
message:
  Applied patch from Tran, work in progress in indicator chart
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItem.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm


--
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	2010-07-30 12:59:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2010-08-28 10:44:15 +0000
@@ -47,6 +47,7 @@
 {
     public static final String DIMENSION_PERIOD = "period";
     public static final String DIMENSION_ORGANISATIONUNIT = "organisationUnit";
+    public static final String DIMENSION_INDICATOR = "indicator";
     
     public static final String TYPE_BAR = "bar";
     public static final String TYPE_LINE = "line";

=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItem.hbm.xml'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItem.hbm.xml	2010-03-11 08:10:12 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItem.hbm.xml	2010-08-28 10:44:15 +0000
@@ -21,9 +21,6 @@
 				foreign-key="fk_exceltitem_group" lazy="false" insert="true" />
 		</properties>
 
-
-
-
 		<property name="expression" column="expression" not-null="true" />
 
 		<property name="row" column="excelrow" not-null="true" />
@@ -32,7 +29,6 @@
 
 		<property name="sheetNo" column="sheetNo" not-null="true" />
 
-
 	</class>
 
 </hibernate-mapping>

=== 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	2010-07-28 13:44:59 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2010-08-28 10:44:15 +0000
@@ -29,6 +29,7 @@
 
 import static org.hisp.dhis.chart.Chart.DIMENSION_ORGANISATIONUNIT;
 import static org.hisp.dhis.chart.Chart.DIMENSION_PERIOD;
+import static org.hisp.dhis.chart.Chart.DIMENSION_INDICATOR;
 import static org.hisp.dhis.chart.Chart.SIZE_NORMAL;
 import static org.hisp.dhis.chart.Chart.TYPE_BAR;
 import static org.hisp.dhis.chart.Chart.TYPE_LINE;
@@ -89,17 +90,20 @@
     implements ChartService
 {
     private static final Font titleFont = new Font( "Tahoma", Font.BOLD, 14 );
+
     private static final Font subTitleFont = new Font( "Tahoma", Font.PLAIN, 12 );
+
     private static final String TREND_PREFIX = "Trend - ";
+
     private static final String TITLE_SEPARATOR = " - ";
+
     private static final String DEFAULT_TITLE_PIVOT_CHART = "Pivot Chart";
-    
-    private static final Color[] colors = {
-        Color.decode( "#d54a4a" ), Color.decode( "#2e4e83" ), Color.decode( "#75e077" ),
-        Color.decode( "#e3e274" ), Color.decode( "#e58c6d" ), Color.decode( "#df6ff3" ),
-        Color.decode( "#88878e" ), Color.decode( "#6ff3e8" ), Color.decode( "#6fc3f3" ),
-        Color.decode( "#aaf36f" ), Color.decode( "#9d6ff3" ), Color.decode( "#474747" ) };        
-    
+
+    private static final Color[] colors = { Color.decode( "#d54a4a" ), Color.decode( "#2e4e83" ),
+        Color.decode( "#75e077" ), Color.decode( "#e3e274" ), Color.decode( "#e58c6d" ), Color.decode( "#df6ff3" ),
+        Color.decode( "#88878e" ), Color.decode( "#6ff3e8" ), Color.decode( "#6fc3f3" ), Color.decode( "#aaf36f" ),
+        Color.decode( "#9d6ff3" ), Color.decode( "#474747" ) };
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -109,10 +113,10 @@
     public void setChartStore( ChartStore chartStore )
     {
         this.chartStore = chartStore;
-    }    
-    
+    }
+
     private PeriodService periodService;
-    
+
     public void setPeriodService( PeriodService periodService )
     {
         this.periodService = periodService;
@@ -124,14 +128,14 @@
     {
         this.dataValueService = dataValueService;
     }
-    
+
     private MinMaxDataElementService minMaxDataElementService;
 
     public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
     {
         this.minMaxDataElementService = minMaxDataElementService;
     }
-    
+
     private AggregationService aggregationService;
 
     public void setAggregationService( AggregationService aggregationService )
@@ -150,23 +154,23 @@
     public JFreeChart getJFreeChart( int id, I18nFormat format )
     {
         Chart chart = getChart( id );
-        
+
         if ( chart.getRelatives() != null )
         {
-            chart.setRelativePeriods( periodService.reloadPeriods( chart.getRelatives().getRelativePeriods( 1, null, false ) ) );
+            chart.setRelativePeriods( periodService.reloadPeriods( chart.getRelatives().getRelativePeriods( 1, null,
+                false ) ) );
         }
-        
-        chart.setFormat( format );        
+
+        chart.setFormat( format );
         chart.init();
-        
+
         return getJFreeChart( chart, true );
     }
 
-    public JFreeChart getJFreeChart( List<Indicator> indicators, List<Period> periods, 
+    public JFreeChart getJFreeChart( List<Indicator> indicators, List<Period> periods,
         List<OrganisationUnit> organisationUnits, String dimension, boolean regression, I18nFormat format )
     {
         Chart chart = new Chart();
-        
         chart.setTitle( getTitle( indicators, periods, organisationUnits, format ) );
         chart.setType( TYPE_BAR );
         chart.setSize( SIZE_NORMAL );
@@ -179,69 +183,72 @@
         chart.setPeriods( periods );
         chart.setOrganisationUnits( organisationUnits );
         chart.setFormat( format );
-        
+
         chart.init();
-        
+
         return getJFreeChart( chart, false );
     }
-    
-    public JFreeChart getJFreeChart( String title, PlotOrientation orientation, 
-        CategoryLabelPositions labelPositions, Map<String, Double> categoryValues )
+
+    public JFreeChart getJFreeChart( String title, PlotOrientation orientation, CategoryLabelPositions labelPositions,
+        Map<String, Double> categoryValues )
     {
         DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
-        
+
         for ( Entry<String, Double> entry : categoryValues.entrySet() )
         {
             dataSet.addValue( entry.getValue(), title, entry.getKey() );
         }
-        
+
         CategoryPlot plot = getCategoryPlot( dataSet, getBarRenderer(), orientation, labelPositions );
-        
+
         JFreeChart jFreeChart = getBasicJFreeChart( plot );
 
         return jFreeChart;
     }
-    
-    public JFreeChart getJFreeChartHistory( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
-        Period lastPeriod, OrganisationUnit organisationUnit, int historyLength, I18nFormat format )
+
+    public JFreeChart getJFreeChartHistory( DataElement dataElement,
+        DataElementCategoryOptionCombo categoryOptionCombo, Period lastPeriod, OrganisationUnit organisationUnit,
+        int historyLength, I18nFormat format )
     {
         List<Period> periods = periodService.getPeriods( lastPeriod, historyLength );
 
-        MinMaxDataElement minMax = minMaxDataElementService.getMinMaxDataElement( organisationUnit, dataElement, categoryOptionCombo );
-        
+        MinMaxDataElement minMax = minMaxDataElementService.getMinMaxDataElement( organisationUnit, dataElement,
+            categoryOptionCombo );
+
         UnivariateRealInterpolator interpolator = new SplineInterpolator();
-        
+
         Integer periodCount = 0;
         List<Double> x = new ArrayList<Double>();
         List<Double> y = new ArrayList<Double>();
-        
+
         // ---------------------------------------------------------------------
         // DataValue, MinValue and MaxValue DataSets
         // ---------------------------------------------------------------------
 
         DefaultCategoryDataset dataValueDataSet = new DefaultCategoryDataset();
         DefaultCategoryDataset metaDataSet = new DefaultCategoryDataset();
-                
+
         for ( Period period : periods )
         {
             ++periodCount;
-            
+
             period.setName( format.formatPeriod( period ) );
-            
-            DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, categoryOptionCombo );
-            
+
+            DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period,
+                categoryOptionCombo );
+
             double value = 0;
-            
+
             if ( dataValue != null && dataValue.getValue() != null && MathUtils.isNumeric( dataValue.getValue() ) )
             {
                 value = Double.parseDouble( dataValue.getValue() );
-                
+
                 x.add( periodCount.doubleValue() );
                 y.add( value );
             }
-            
+
             dataValueDataSet.addValue( value, dataElement.getShortName(), period.getName() );
-            
+
             if ( minMax != null )
             {
                 metaDataSet.addValue( minMax.getMin(), "Min value", period.getName() );
@@ -258,14 +265,14 @@
             periodCount = 0;
 
             double[] xa = getArray( x );
-            
+
             int min = MathUtils.getMin( xa ).intValue();
             int max = MathUtils.getMax( xa ).intValue();
-            
+
             try
             {
                 UnivariateRealFunction function = interpolator.interpolate( xa, getArray( y ) );
-                    
+
                 for ( Period period : periods )
                 {
                     if ( ++periodCount >= min && periodCount <= max )
@@ -284,16 +291,17 @@
         // Plots
         // ---------------------------------------------------------------------
 
-        CategoryPlot plot = getCategoryPlot( dataValueDataSet, getBarRenderer(), PlotOrientation.VERTICAL, CategoryLabelPositions.UP_45 );
-        
-        plot.setDataset( 1, metaDataSet );        
+        CategoryPlot plot = getCategoryPlot( dataValueDataSet, getBarRenderer(), PlotOrientation.VERTICAL,
+            CategoryLabelPositions.UP_45 );
+
+        plot.setDataset( 1, metaDataSet );
         plot.setRenderer( 1, getLineRenderer() );
-        
+
         JFreeChart jFreeChart = getBasicJFreeChart( plot );
 
         return jFreeChart;
     }
-    
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
@@ -310,11 +318,11 @@
 
         return jFreeChart;
     }
-    
+
     /**
      * Returns a CategoryPlot.
      */
-    private CategoryPlot getCategoryPlot( CategoryDataset dataSet, CategoryItemRenderer renderer, 
+    private CategoryPlot getCategoryPlot( CategoryDataset dataSet, CategoryItemRenderer renderer,
         PlotOrientation orientation, CategoryLabelPositions labelPositions )
     {
         CategoryPlot plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), renderer );
@@ -327,7 +335,7 @@
 
         return plot;
     }
-    
+
     /**
      * Returns a bar renderer.
      */
@@ -342,10 +350,10 @@
             renderer.setSeriesPaint( i, colors[i] );
             renderer.setShadowVisible( false );
         }
-        
+
         return renderer;
     }
-    
+
     /**
      * Returns a line and shape renderer.
      */
@@ -357,10 +365,10 @@
         {
             renderer.setSeriesPaint( i, colors[i] );
         }
-        
+
         return renderer;
     }
-    
+
     /**
      * Returns a JFreeChart of type defined in the chart argument.
      */
@@ -368,13 +376,13 @@
     {
         final BarRenderer barRenderer = getBarRenderer();
         final LineAndShapeRenderer lineRenderer = getLineRenderer();
-        
+
         // ---------------------------------------------------------------------
         // Plot
         // ---------------------------------------------------------------------
 
         CategoryPlot plot = null;
-        
+
         CategoryDataset[] dataSets = getCategoryDataSet( chart );
 
         if ( chart.isType( TYPE_LINE ) )
@@ -382,36 +390,38 @@
             plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), lineRenderer );
         }
         else
-        {            
-            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), barRenderer );    
+        {
+            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), barRenderer );
         }
-        
+
         if ( chart.isRegression() )
         {
             plot.setDataset( 1, dataSets[1] );
             plot.setRenderer( 1, lineRenderer );
         }
-        
+
         JFreeChart jFreeChart = new JFreeChart( chart.getTitle(), titleFont, plot, !chart.isHideLegend() );
-        
+
         if ( subTitle )
         {
             jFreeChart.addSubtitle( getSubTitle( chart, chart.getFormat() ) );
         }
-        
+
         // ---------------------------------------------------------------------
         // Plot orientation
         // ---------------------------------------------------------------------
 
-        plot.setOrientation( chart.isHorizontalPlotOrientation() ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL );
+        plot.setOrientation( chart.isHorizontalPlotOrientation() ? PlotOrientation.HORIZONTAL
+            : PlotOrientation.VERTICAL );
         plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
-        
+
         // ---------------------------------------------------------------------
         // Category label positions
         // ---------------------------------------------------------------------
 
         CategoryAxis xAxis = plot.getDomainAxis();
-        xAxis.setCategoryLabelPositions( chart.isVerticalLabels() ? CategoryLabelPositions.UP_45 : CategoryLabelPositions.STANDARD );
+        xAxis.setCategoryLabelPositions( chart.isVerticalLabels() ? CategoryLabelPositions.UP_45
+            : CategoryLabelPositions.STANDARD );
 
         // ---------------------------------------------------------------------
         // Color & antialias
@@ -422,7 +432,7 @@
 
         return jFreeChart;
     }
-    
+
     /**
      * Returns a DefaultCategoryDataSet based on aggregated data for the chart.
      */
@@ -430,19 +440,20 @@
     {
         final DefaultCategoryDataset regularDataSet = new DefaultCategoryDataset();
         final DefaultCategoryDataset regressionDataSet = new DefaultCategoryDataset();
-        
+
         if ( chart != null )
         {
             Period selectedPeriod = chart.getAllPeriods().get( 0 );
             OrganisationUnit selectedOrganisationUnit = chart.getOrganisationUnits().get( 0 );
-            
+
             for ( Indicator indicator : chart.getIndicators() )
             {
                 final SimpleRegression regression = new SimpleRegression();
-                
+
                 int columnIndex = 0;
-                
-                if ( chart.isDimension( DIMENSION_PERIOD ) )
+
+                if ( chart.isDimension( DIMENSION_PERIOD ) || chart.isDimension( DIMENSION_INDICATOR ) )
+
                 {
                     // ---------------------------------------------------------
                     // Regular dataset
@@ -450,33 +461,51 @@
 
                     for ( Period period : chart.getAllPeriods() )
                     {
-                        final Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period.getEndDate(), selectedOrganisationUnit );
-
-                        regularDataSet.addValue( value != null ? value : 0, indicator.getShortName(), chart.getFormat().formatPeriod( period ) );
-                        
+                        final Double value = aggregationService.getAggregatedIndicatorValue( indicator, period
+                            .getStartDate(), period.getEndDate(), selectedOrganisationUnit );
+
+                        if ( chart.isDimension( DIMENSION_PERIOD ) )
+                        {
+
+                            regularDataSet.addValue( value != null ? value : 0, indicator.getShortName(), chart
+                                .getFormat().formatPeriod( period ) );
+
+                        }
+                        else
+                        {
+                            regularDataSet.addValue( value != null ? value : 0,
+                                chart.getFormat().formatPeriod( period ), indicator.getShortName() );
+                        }
                         columnIndex++;
-                        
-                        if ( value != null && value != 0.0 ) // Omit missing values and 0 from regression
+
+                        if ( value != null && value != 0.0 ) // Omit missing
+                        // values and 0
+                        // from regression
                         {
                             regression.addData( columnIndex, value );
                         }
                     }
-                    
+
                     // ---------------------------------------------------------
                     // Regression dataset
                     // ---------------------------------------------------------
 
                     columnIndex = 0;
-                    
+
                     if ( chart.isRegression() )
                     {
                         for ( Period period : chart.getAllPeriods() )
                         {
                             final double value = regression.predict( columnIndex++ );
-                            
-                            if ( !Double.isNaN( value ) ) // Enough values must exist for regression
+
+                            if ( !Double.isNaN( value ) ) // Enough values
+                            // must
+                            // exist for
+                            // regression
                             {
-                                regressionDataSet.addValue( value, TREND_PREFIX + indicator.getShortName(), chart.getFormat().formatPeriod( period ) );
+                                regressionDataSet.addValue( value, TREND_PREFIX + indicator.getShortName(), chart
+                                    .getFormat().formatPeriod( period ) );
+
                             }
                         }
                     }
@@ -489,65 +518,69 @@
 
                     for ( OrganisationUnit unit : chart.getOrganisationUnits() )
                     {
-                        final Double value = aggregationService.getAggregatedIndicatorValue( indicator, selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), unit );
-                        
-                        regularDataSet.addValue( value != null ? value : 0, indicator.getShortName(), unit.getShortName() );
-                        
+                        final Double value = aggregationService.getAggregatedIndicatorValue( indicator, selectedPeriod
+                            .getStartDate(), selectedPeriod.getEndDate(), unit );
+
+                        regularDataSet.addValue( value != null ? value : 0, indicator.getShortName(), unit
+                            .getShortName() );
+
                         columnIndex++;
                     }
-                    
-                    // Regression not relevant for organisation unit category
+
+                    // Regression not relevant for organisation unit
+                    // category
                 }
+
             }
         }
-        
+
         return new CategoryDataset[] { regularDataSet, regressionDataSet };
     }
 
     /**
      * Returns a title based on the chart meta data.
      */
-    private String getTitle( List<Indicator> indicators, List<Period> periods, 
+    private String getTitle( List<Indicator> indicators, List<Period> periods,
         List<OrganisationUnit> organisationUnits, I18nFormat format )
     {
         String title = "";
-        
+
         if ( indicators != null && indicators.size() == 1 )
         {
             title += indicators.get( 0 ).getShortName() + TITLE_SEPARATOR;
         }
-        
+
         if ( periods != null && periods.size() == 1 )
         {
             title += format.formatPeriod( periods.get( 0 ) ) + TITLE_SEPARATOR;
         }
-        
+
         if ( organisationUnits != null && organisationUnits.size() == 1 )
         {
             title += organisationUnits.get( 0 ).getShortName() + TITLE_SEPARATOR;
         }
-        
+
         if ( title.length() == 0 )
         {
             title = DEFAULT_TITLE_PIVOT_CHART;
         }
         else
         {
-            title = title.substring( 0, ( title.length() - TITLE_SEPARATOR.length() ) );
+            title = title.substring( 0, (title.length() - TITLE_SEPARATOR.length()) );
         }
-        
+
         return title;
     }
-    
+
     /**
      * Returns a subtitle based on the chart dimension.
      */
     private TextTitle getSubTitle( Chart chart, I18nFormat format )
     {
         TextTitle subTitle = new TextTitle();
-        
+
         subTitle.setFont( subTitleFont );
-        
+
         if ( chart.isDimension( DIMENSION_PERIOD ) && chart.getOrganisationUnits().size() > 0 )
         {
             subTitle.setText( chart.getOrganisationUnits().get( 0 ).getName() );
@@ -556,10 +589,10 @@
         {
             subTitle.setText( format.formatPeriod( chart.getAllPeriods().get( 0 ) ) );
         }
-        
+
         return subTitle;
     }
-    
+
     // -------------------------------------------------------------------------
     // CRUD operations
     // -------------------------------------------------------------------------
@@ -568,32 +601,32 @@
     {
         return chartStore.save( chart );
     }
-    
+
     public void saveOrUpdate( Chart chart )
     {
         chartStore.saveOrUpdate( chart );
     }
-    
+
     public Chart getChart( int id )
     {
         return chartStore.get( id );
     }
-    
+
     public void deleteChart( Chart chart )
     {
         chartStore.delete( chart );
     }
-    
+
     public Collection<Chart> getAllCharts()
     {
         return chartStore.getAll();
     }
-    
+
     public Chart getChartByTitle( String name )
     {
         return chartStore.getByTitle( name );
     }
-    
+
     public Collection<Chart> getCharts( final Collection<Integer> identifiers )
     {
         Collection<Chart> charts = getAllCharts();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2010-07-19 13:19:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2010-08-28 10:44:15 +0000
@@ -306,7 +306,7 @@
 select_indicator								= Please select indicator
 annualized										= Annualized
 could_not_save									= Could not save
-object_not_deleted_associated_by_objects		= Object not deleted becuause it is associated by objects of type
+object_not_deleted_associated_by_objects		= Object not deleted because it is associated by objects of type
 hide_warning									= Hide warning
 please_enter_name								= Please enter name !
 group_ready_exist 								= Group ready exist

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java	2010-08-28 10:44:15 +0000
@@ -110,7 +110,7 @@
             chart = chartService.getJFreeChart( id, format );
             
             Chart temp = chartService.getChart( id );
-                        
+            
             width = temp.getWidth();            
             height = temp.getHeight();
             

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-08-27 07:07:57 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-08-28 10:44:15 +0000
@@ -307,4 +307,10 @@
 intro_chart = View and add charts. Charts are based on indicators and either organisation units or periods.
 intro_pivot_table = Browse pivot tables, which can be pivoted on any of the indicator, organisation unit and period dimensions.
 intro_report_table = Add and generate report tables. Report tables are highly customizable database tables which can be used as basis for reports.
-intro_data_completeness = Browse the submission rates of data sets. This can be viewed by organisation unit and period, and later reported to PDF and Workbook.
\ No newline at end of file
+intro_data_completeness = Browse the submission rates of data sets. This can be viewed by organisation unit and period, and later reported to PDF and Workbook.
+add_indicator_chart = Add indicator chart
+create_period_by_indicator_chart = Create period by indicator chart
+value_x_selected_indicators = Value (X) - Selected indicators
+value_x_available_indicators = Value (X) - Available indicators
+category_y_selected_periods = Value (Y) - Selected periods
+value_y_available_indicators = Value (Y) - Available periods
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm	2010-06-25 10:31:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm	2010-08-28 10:44:15 +0000
@@ -1,9 +1,10 @@
-
 #macro ( getHeader )
 	#if ( $dimension == "period" )
 		$i18n.getString( "create_indicator_by_period_chart" )
-	#else
+	#elseif ( $dimension == "organisationUnit" )
 	    $i18n.getString( "create_indicator_by_organisation_unit_chart" )
+	#elseif ( $dimension == "indicator" )
+	    $i18n.getString( "create_period_by_indicator_chart" )
 	#end
 #end
 
@@ -64,75 +65,12 @@
     
 </table>
 
+#if ( $dimension == "indicator" )
+    #parse( "dhis-web-reporting/addChartIndicatorModeForm.vm" )
+#else 
+	#parse( "dhis-web-reporting/addChartOrgunitOrPeriodForm.vm" )
+#end
 <table>
-
-    <col>       
-    <col width="16">
-    	
-    <!-- Indicators -->
-    <tr>
-        <th colspan="2">$i18n.getString( "value_y_available_indicators" )</th>
-    </tr>
-    <tr>
-        <td colspan="2">
-            <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:600px" onchange="getIndicators()">
-                <option value="$ALL">[ $i18n.getString( "select_indicatorgroup_all" ) ]</option>
-                #foreach ( $group in $indicatorGroups )
-                    <option value="$group.id">$group.name</option>
-                #end
-            </select>
-        </td>
-        <td></td>
-    </tr>
-    <tr>
-        <td colspan="2">
-            <select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:600px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">             
-                #foreach ( $indicator in $availableIndicators )
-                    <option value="$indicator.id">$indicator.name</option>
-                #end
-            </select>
-        </td>
-    </tr>
-    <tr>
-        <td colspan="2">
-            <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )"><input 
-                type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )"><input 
-                type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )"><input 
-                type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedIndicators', 'availableIndicators' )">
-        </td>
-    </tr>
-    <tr>
-        <th colspan="2">$i18n.getString( "value_y_selected_indicators" )</th>
-    </tr>
-    <tr>
-        <td>
-            <select multiple size="6" id="selectedIndicators" name="selectedIndicators" style="min-width:600px" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
-                #foreach( $indicator in $selectedIndicators )
-                    <option value="$indicator.id">$indicator.name</option>
-                #end
-            </select>                  
-        </td>
-        <td>
-            <a href="#" onclick="moveUpSelectedOption( 'selectedIndicators' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
-            <a href="#" onclick="moveDownSelectedOption( 'selectedIndicators' )"><img src="../images/move_down.png" border="0" alt=""></a>        
-        </td>
-    </tr>
-    <tr>
-        <td colspan="2" style="height:15px"></td>
-    </tr>
-    
-    <!-- Category -->
-    
-    #if ( $dimension == "period" )
-    	#parse( "dhis-web-reporting/addChartPeriodModeForm.vm" )
-    #else
-        #parse( "dhis-web-reporting/addChartOrganisationUnitModeForm.vm" )
-    #end    
-    
-    <tr>
-        <td colspan="2" style="height:15px"></td>
-    </tr>
-        
     <!-- Submit -->
     
     <tr>        

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2010-07-18 15:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2010-08-28 10:44:15 +0000
@@ -1,4 +1,4 @@
-
+<table>
 <!-- Periods -->
 
 <tr>
@@ -123,3 +123,4 @@
         </select>
     </td>
 </tr>
+<table>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2010-07-04 23:55:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2010-08-28 10:44:15 +0000
@@ -73,7 +73,7 @@
     {
         selectAllById( "selectedIndicators" );
         
-        if ( dimension == "period" )
+        if ( dimension == "period" || dimension == "indicator")
         {
             selectAllById( "selectedPeriods" );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm	2010-07-04 23:55:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm	2010-08-28 10:44:15 +0000
@@ -8,7 +8,8 @@
 				  <tr>
                     <td align="right">
                     	<input type="button" value="$i18n.getString( 'add_period_chart' )" style="width:200px" onclick="window.location.href='displayAddChartForm.action?dimension=period'"><br>
-                    	<input type="button" value="$i18n.getString( 'add_organisation_unit_chart' )" style="width:200px" onclick="window.location.href='displayAddChartForm.action?dimension=organisationUnit'">
+                    	<input type="button" value="$i18n.getString( 'add_organisation_unit_chart' )" style="width:200px" onclick="window.location.href='displayAddChartForm.action?dimension=organisationUnit'"><br>
+						<input type="button" value="$i18n.getString( 'add_indicator_chart' )" style="width:200px" onclick="window.location.href='displayAddChartForm.action?dimension=indicator'">
                     </td>
                 </tr>
 			</table>