← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1987: Added Graphical Analysis Data Element Wise

 

------------------------------------------------------------
revno: 1987
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-11-02 17:05:05 +0530
message:
  Added Graphical Analysis Data Element Wise
added:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportDataElementToExcelAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DataElementChartResult.java
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/ExportToExcelAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/AreaChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/DualAxisChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Horizontal3DBarChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineAndBarChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/PieChart3D.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/StandardChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/SurveyChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Vertical3DBarChart.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-dashboard/src/main/resources/struts.xml
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.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
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportDataElementToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportDataElementToExcelAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportDataElementToExcelAction.java	2010-11-02 11:35:05 +0000
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+package org.hisp.dhis.dashboard.action;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import jxl.CellType;
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.CellFormat;
+import jxl.format.Colour;
+import jxl.write.Label;
+import jxl.write.Number;
+import jxl.write.WritableCell;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableImage;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
+
+import com.keypoint.PngEncoder;
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version ExportDataElementToExcelAction.java Oct 29, 2010 1:59:14 PM
+ */
+public class ExportDataElementToExcelAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+/*
+    private LocationManager locationManager;
+
+    public void setLocationManager( LocationManager locationManager )
+    {
+        this.locationManager = locationManager;
+    }
+ */  
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input & output
+    // -------------------------------------------------------------------------
+    
+    double[][] data1;
+
+  //  double[][] data2;
+
+    String[] series1;
+
+   // String[] series2;
+
+    String[] categories1;
+
+  //  String[] categories2;
+
+    
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+
+    /*
+    private String contentType;
+
+    public String getContentType()
+    {
+        return contentType;
+    }
+    */
+
+    private String fileName;
+
+    public String getFileName()
+    {
+        return fileName;
+    }
+
+    /*
+    private int bufferSize;
+
+    public int getBufferSize()
+    {
+        return bufferSize;
+    }
+    */
+
+    private String viewSummary;
+    
+    public void setViewSummary( String viewSummary )
+    {
+        this.viewSummary = viewSummary;
+    }
+    
+    private String chartDisplayOption;
+
+    public void setChartDisplayOption( String chartDisplayOption )
+    {
+        this.chartDisplayOption = chartDisplayOption;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {   
+        int tempCol1 = 0;
+        int tempRow1 = 1;
+        
+        ActionContext ctx = ActionContext.getContext();
+        HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );                        
+        HttpSession session = req.getSession();
+        BufferedImage chartImage = (BufferedImage) session.getAttribute("chartImage");
+        PngEncoder encoder = new PngEncoder(chartImage, false, 0, 9);
+        
+        byte[] encoderBytes = encoder.pngEncode();
+        Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
+        //Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+        
+        String[] series1S = (String[]) session.getAttribute( "series1" );
+        //String[] series2S = (String[]) session.getAttribute( "series2" );
+        String[] categories1S = (String[]) session.getAttribute( "categories1" );
+       // String[] categories2S = (String[]) session.getAttribute( "categories2" );
+                        
+
+      //  initialzeAllLists(series1S, series2S, categories1S, categories2S);
+        initialzeAllLists(series1S, categories1S );
+        
+        //if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null )
+        if(objData1 == null || series1 == null ||  categories1 == null )
+                System.out.println("Session Objects are null");
+        else
+                System.out.println("Session Objects are not null");
+        
+        data1 = convertDoubleTodouble( objData1 );
+      //  data2 = convertDoubleTodouble( objData2 );
+        
+        if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
+        else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
+        else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
+        else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }          
+                
+        //File outputReportFile = locationManager.getFileForWriting( UUID.randomUUID().toString() + ".xls", "db", "output" );
+        
+        
+     //   String outputReportFile = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+     //   + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+          String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+          + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+       
+       // System.out.println("Env Variable is  :" + System.getenv( "DHIS2_HOME" ) );
+       // System.out.println("Complete path is :" + outputReportFile );
+        
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) );
+        WritableSheet sheet0 = outputReportWorkbook.createSheet( "DataElementChartOutput", 0 );
+        
+        if(viewSummary.equals( "no" ))
+        {
+            WritableImage writableImage = new WritableImage(0,1,10,23,encoderBytes);
+            sheet0.addImage( writableImage );
+            tempRow1 = 24;
+        }    
+        else
+        {
+            tempRow1 -= objData1.length;
+        }
+
+                
+        int count1 = 0;
+        int count2 = 0;
+        int flag1 = 0;
+        while(count1 <= categories1.length)
+        {
+            for(int j=0;j<data1.length;j++)
+            {            
+                tempCol1 = 1;
+                tempRow1++;
+                WritableCellFormat wCellformat1 = new WritableCellFormat();                            
+                wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+                wCellformat1.setWrap( true );
+
+                WritableCellFormat wCellformat2 = new WritableCellFormat();                            
+                wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+                wCellformat2.setAlignment( Alignment.CENTRE );
+                wCellformat2.setBackground( Colour.GRAY_25 );                
+                wCellformat2.setWrap( true );
+
+                
+                WritableCell cell1;
+                CellFormat cellFormat1;
+                            
+                for(int k=count2;k<count1;k++)
+                {
+                    if(k==count2 && j==0)
+                    {                                       
+                        tempCol1 = 0;
+                        tempRow1++;
+                        cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+                        cellFormat1 = cell1.getCellFormat();
+
+
+                        if (cell1.getType() == CellType.LABEL)
+                        {
+                            Label l = (Label) cell1;
+                            l.setString("Service");
+                            l.setCellFormat( cellFormat1 );
+                        }
+                        else
+                        {
+                            sheet0.addCell( new Label( tempCol1, tempRow1, "Service", wCellformat2) );
+                        }
+                        tempCol1++;
+                    
+                        for(int i=count2; i< count1; i++)
+                        {                        
+                            cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+                            cellFormat1 = cell1.getCellFormat();
+                            if (cell1.getType() == CellType.LABEL)
+                            {
+                                Label l = (Label) cell1;
+                                l.setString(categories1[i]);
+                                l.setCellFormat( cellFormat1 );
+                            }
+                            else
+                            {
+                                sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
+                            }
+                            tempCol1++;
+                        }
+                        tempRow1++;
+                        tempCol1 = 1;
+                    }
+                
+                
+                    if(k==count2)
+                    {
+                        tempCol1 = 0;
+                        cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+                        cellFormat1 = cell1.getCellFormat();
+
+                        if (cell1.getType() == CellType.LABEL)
+                        {
+                            Label l = (Label) cell1;
+                            l.setString(series1[j]);
+                            l.setCellFormat( cellFormat1 );
+                        }
+                        else
+                        {
+                            sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+                        }
+                        tempCol1++;
+                    }
+                    cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+                    cellFormat1 = cell1.getCellFormat();
+
+                    if (cell1.getType() == CellType.LABEL)
+                    {
+                        Label l = (Label) cell1;
+                        l.setString(""+data1[j][k]);
+                        l.setCellFormat( cellFormat1 );
+                    }
+                    else
+                    {
+                        sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
+                        //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
+                    }
+                    tempCol1++;                
+                }
+            }
+            if(flag1 == 1) break;
+            count2 = count1;
+            if( (count1+10 > categories1.length) && (categories1.length - count1 <= 10))
+                {
+                count1 += categories1.length - count1;
+                flag1 = 1;
+                }
+            else
+                count1 += 10;
+        } 
+        outputReportWorkbook.write();
+        outputReportWorkbook.close();
+
+        fileName = "DataElement Chart Output.xls";
+                
+        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+
+        return SUCCESS;
+    }
+    
+    
+//    public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
+    public void initialzeAllLists(String[]series1S, String[] categories1S)
+    {
+        int i;
+        series1 = new String[series1S.length];
+       // series2 = new String[series2S.length];
+        categories1 = new String[categories1S.length];
+       // categories2 = new String[categories2S.length];
+        
+        for(i = 0; i < series1S.length; i++)
+        {
+                series1[i] = series1S[i];
+        }
+/*
+        for(i = 0; i < series2S.length; i++)
+        {
+                series2[i] = series2S[i];
+        }
+*/        
+        for(i = 0; i < categories1S.length; i++)
+        {
+                categories1[i] = categories1S[i];
+        }
+/*        
+        for(i = 0; i < categories2S.length; i++)
+        {
+                categories2[i] = categories2S[i];
+        }
+*/        
+    }
+    
+    public double[][] convertDoubleTodouble( Double[][] objData )
+    {
+        //System.out.println("Before Sorting : ");
+        double[][] data = new double[objData.length][objData[0].length];
+        for ( int i = 0; i < objData.length; i++ )
+        {
+            for ( int j = 0; j < objData[0].length; j++ )
+            {
+                data[i][j] = objData[i][j].doubleValue();
+                //System.out.print(categories1[j]+": "+data[i][j]+", ");                
+            }
+            //System.out.println("");
+        }
+
+        return data;
+    }// convertDoubleTodouble end
+
+    public void sortByAscending()
+    {
+        for(int i=0; i < categories1.length-1 ; i++)
+        {
+                for(int j=0; j < categories1.length-1-i; j++)
+                {
+                        if(data1[0][j] > data1[0][j+1])
+                        {
+                                for(int k=0; k<series1.length; k++)
+                                {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories1[j];
+                                categories1[j] = categories1[j+1];
+                                categories1[j+1] = temp2;
+                        }
+                }
+        }
+        
+        /*
+        for(int i=0; i < categories2.length-1 ; i++)
+        {
+                for(int j=0; j < categories2.length-1-i; j++)
+                {
+                        if(data2[0][j] > data2[0][j+1])
+                        {
+                                for(int k=0; k<series2.length; k++)
+                                {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories2[j];
+                                categories2[j] = categories2[j+1];
+                                categories2[j+1] = temp2;
+                        }
+                }
+        }
+        */
+        
+    }
+
+    public void sortByDesscending()
+    {
+        for(int i=0; i < categories1.length-1 ; i++)
+        {
+                for(int j=0; j < categories1.length-1-i; j++)
+                {
+                        if(data1[0][j] < data1[0][j+1])
+                        {
+                                for(int k=0; k<series1.length; k++)
+                                {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories1[j];
+                                categories1[j] = categories1[j+1];
+                                categories1[j+1] = temp2;
+                        }
+                }
+        }
+        
+        /*
+        for(int i=0; i < categories2.length-1 ; i++)
+        {
+                for(int j=0; j < categories2.length-1-i; j++)
+                {
+                        if(data2[0][j] < data2[0][j+1])
+                        {
+                                for(int k=0; k<series2.length; k++)
+                                {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories2[j];
+                                categories2[j] = categories2[j+1];
+                                categories2[j+1] = temp2;
+                        }
+                }
+        }
+        */
+    }   
+    
+    public void sortByAlphabet()
+        {
+                for(int i=0; i < categories1.length-1 ; i++)
+                {
+                        for(int j=0; j < categories1.length-1-i; j++)
+                        {
+                                if(categories1[j].compareToIgnoreCase(categories1[j+1]) > 0)
+                                {
+                                        for(int k=0; k<series1.length; k++)
+                                        {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                        }
+                                        
+                                        String temp2 = categories1[j];
+                                        categories1[j] = categories1[j+1];
+                                        categories1[j+1] = temp2;
+                                }
+                        }
+                }
+
+                /*
+                for(int i=0; i < categories2.length-1 ; i++)
+                {
+                        for(int j=0; j < categories2.length-1-i; j++)
+                        {
+                                if(categories2[j].compareToIgnoreCase(categories2[j+1]) > 0)
+                                {
+                                        for(int k=0; k<series2.length; k++)
+                                        {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                        }
+                                        
+                                        String temp2 = categories2[j];
+                                        categories2[j] = categories2[j+1];
+                                        categories2[j+1] = temp2;
+                                }
+                        }
+                }
+                */
+        
+    }
+
+
+}

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java	2010-09-28 11:08:55 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java	2010-11-02 11:35:05 +0000
@@ -162,7 +162,7 @@
         
      //   String outputReportFile = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
      //   + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-        String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+          String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
           + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
        
        // System.out.println("Env Variable is  :" + System.getenv( "DHIS2_HOME" ) );

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataAction.java	2010-11-02 11:35:05 +0000
@@ -46,24 +46,26 @@
 
         HttpSession session = req.getSession();
         Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
-        Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+      //  Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
                 
 
         String[] series1S = (String[]) session.getAttribute( "series1" );
-        String[] series2S = (String[]) session.getAttribute( "series2" );
+      //  String[] series2S = (String[]) session.getAttribute( "series2" );
         String[] categories1S = (String[]) session.getAttribute( "categories1" );
-        String[] categories2S = (String[]) session.getAttribute( "categories2" );
+       // String[] categories2S = (String[]) session.getAttribute( "categories2" );
                         
 
-        initialzeAllLists(series1S, series2S, categories1S, categories2S);
+       // initialzeAllLists(series1S, series2S, categories1S, categories2S);
+        initialzeAllLists(series1S,  categories1S);
         
-        if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null )
+//        if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null )
+        if(objData1 == null || series1 == null ||  categories1 == null  )    
                 System.out.println("Session Objects are null");
         else
                 System.out.println("Session Objects are not null");
         
         data1 = convertDoubleTodouble( objData1 );
-        data2 = convertDoubleTodouble( objData2 );
+      //  data2 = convertDoubleTodouble( objData2 );
         
         if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
         else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
@@ -102,34 +104,35 @@
         headingInfo.add( "</table>" );
     }
     
-    public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
+//    public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
+    public void initialzeAllLists(String[]series1S,  String[] categories1S )
     {
         int i;
         series1 = new String[series1S.length];
-        series2 = new String[series2S.length];
+       // series2 = new String[series2S.length];
         categories1 = new String[categories1S.length];
-        categories2 = new String[categories2S.length];
+       // categories2 = new String[categories2S.length];
         
         for(i = 0; i < series1S.length; i++)
         {
                 series1[i] = series1S[i];
         }
-
+/*
         for(i = 0; i < series2S.length; i++)
         {
                 series2[i] = series2S[i];
         }
-        
+*/        
         for(i = 0; i < categories1S.length; i++)
         {
                 categories1[i] = categories1S[i];
         }
-        
+/*        
         for(i = 0; i < categories2S.length; i++)
         {
                 categories2[i] = categories2S[i];
         }
-        
+*/        
     }
     
     public double[][] convertDoubleTodouble( Double[][] objData )
@@ -170,7 +173,7 @@
                         }
                 }
         }
-        
+/*        
         for(int i=0; i < categories2.length-1 ; i++)
         {
                 for(int j=0; j < categories2.length-1-i; j++)
@@ -190,8 +193,8 @@
                         }
                 }
         }
-        
-    }
+*/        
+    }  
 
     public void sortByDesscending()
     {
@@ -214,7 +217,7 @@
                         }
                 }
         }
-        
+ /*       
         for(int i=0; i < categories2.length-1 ; i++)
         {
                 for(int j=0; j < categories2.length-1-i; j++)
@@ -234,7 +237,7 @@
                         }
                 }
         }
-
+*/
     }   
     
     public void sortByAlphabet()
@@ -258,7 +261,7 @@
                                 }
                         }
                 }
-                
+ /*               
                 for(int i=0; i < categories2.length-1 ; i++)
                 {
                         for(int j=0; j < categories2.length-1-i; j++)
@@ -278,7 +281,7 @@
                                 }
                         }
                 }
-        
+*/        
     }
     
 }// class end

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/ExportToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/ExportToExcelAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/ExportToExcelAction.java	2010-11-02 11:35:05 +0000
@@ -4,9 +4,9 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.Action;
 
-public class ExportToExcelAction extends ActionSupport
+public class ExportToExcelAction implements Action
 {
     // -------------------------------------------------------------------------
     // Dependencies

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction.java	2010-11-02 11:35:05 +0000
@@ -140,6 +140,8 @@
         String[] categories1S = (String[]) session.getAttribute( "categories1" );
         String[] categories2S = (String[]) session.getAttribute( "categories2" );
                         
+       // series2 = (String[]) session.getAttribute( "series2" );
+        
         chartTitle = (String) session.getAttribute( "chartTitle" );
         xAxis_Title = (String) session.getAttribute( "xAxisTitle" );
         yAxis_Title = (String) session.getAttribute( "yAxisTitle" );
@@ -255,6 +257,7 @@
     }
     
     public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
+    
     {
         int i;
         series1 = new String[series1S.length];
@@ -276,12 +279,12 @@
         {
                 categories1[i] = categories1S[i];
         }
-        
+       
         for(i = 0; i < categories2S.length; i++)
         {
                 categories2[i] = categories2S[i];
         }
-        
+      
     }
     
     public double[][] convertDoubleTodouble( Double[][] objData )

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java	2010-11-02 11:35:05 +0000
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+package org.hisp.dhis.dashboard.ga.action.charts;
+
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.dashboard.ga.charts.AreaChart;
+import org.hisp.dhis.dashboard.ga.charts.Horizontal3DBarChart;
+import org.hisp.dhis.dashboard.ga.charts.LineAndBarChart;
+import org.hisp.dhis.dashboard.ga.charts.LineChart;
+import org.hisp.dhis.dashboard.ga.charts.StandardChart;
+import org.hisp.dhis.dashboard.ga.charts.Vertical3DBarChart;
+import org.jfree.chart.ChartRenderingInfo;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.entity.StandardEntityCollection;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateChartAction1.java Oct 27, 2010 1:17:24 PM
+ */
+
+
+public class GenerateChartAction1
+    implements Action
+{
+    double[][] data1;
+
+   // double[][] data2;
+
+    String[] series1;
+
+   // String[] series2;
+
+    String[] categories1;
+
+   // String[] categories2;
+
+    String chartTitle;
+
+    String xAxis_Title;
+
+    String yAxis_Title;
+
+    private StandardChart selChart;
+    
+   // private Vertical3DBarChart selChart;
+    
+    private HttpSession session;
+    
+    public HttpSession getSession()
+    {
+        return session;
+    }
+    
+    private JFreeChart chart;
+        
+    public JFreeChart getChart()
+    {
+        return chart;
+    }
+
+    private String headingInfo;
+
+    public String getHeadingInfo()
+    {
+        return headingInfo;
+    }
+    
+    private List<String> yseriesList;
+    
+    public List<String> getYseriesList()
+    {
+        return yseriesList;
+    }
+
+    private List<String> xseriesList;
+    
+    public List<String> getXseriesList()
+    {
+        return xseriesList;
+    }
+
+    private List<List<String>> dataList;
+          
+    public List<List<String>> getDataList()
+    {
+        return dataList;
+    }
+
+    public String execute()
+        throws Exception
+    {
+
+        xseriesList = new ArrayList<String>();
+        yseriesList = new ArrayList<String>();
+        dataList = new ArrayList<List<String>>();
+        
+        ActionContext ctx = ActionContext.getContext();
+        HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+        String currentChart = req.getParameter( "currentChart" );
+        String chartDisplayOption = req.getParameter( "chartDisplayOption" );
+
+        //System.out.println("chartDisplayOption : "+chartDisplayOption);
+        session = req.getSession();
+        Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
+       // Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+                
+
+        String[] series1S = (String[]) session.getAttribute( "series1" );
+      //  String[] series2S = (String[]) session.getAttribute( "series2" );
+        String[] categories1S = (String[]) session.getAttribute( "categories1" );
+       // String[] categories2S = (String[]) session.getAttribute( "categories2" );
+                        
+       // series2 = (String[]) session.getAttribute( "series2" );
+        
+        chartTitle = (String) session.getAttribute( "chartTitle" );
+        xAxis_Title = (String) session.getAttribute( "xAxisTitle" );
+        yAxis_Title = (String) session.getAttribute( "yAxisTitle" );
+
+        initialzeAllLists( series1S,  categories1S );
+       /* 
+        System.out.println( "\n data1 : " + objData1 );
+        System.out.println( "\n series1 : " + series1S );
+        System.out.println( "\n categories1 : " + categories1S );
+        System.out.println( "\n chartTitle : " + chartTitle );
+        System.out.println( "\n xAxisTitle : " + xAxis_Title );
+        System.out.println( "\n yAxisTitle : " + yAxis_Title );
+        */
+        
+        if( objData1 == null || series1 == null ||  categories1 == null ||  chartTitle == null || xAxis_Title == null || yAxis_Title == null )
+                System.out.println("Session Objects are null");
+        else
+                System.out.println("Session Objects are not null");
+        
+        data1 = convertDoubleTodouble( objData1 );
+       // data2 = convertDoubleTodouble( objData2 );
+        
+        if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
+        else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
+        else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
+        else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }          
+        
+        initializeDataLists();
+        
+        System.out.println( "current chart Type is : " + currentChart + "And Chart Display Option is : " + chartDisplayOption );
+        
+        if ( currentChart == null )
+        {
+            System.out.println( "current chart is null" );
+            currentChart = "Vertical3DBarChart";
+        }
+
+        else if ( currentChart.equals( "Vertical3DBarChart" ) )
+        {
+            System.out.println( "Vertical3DBarChart" );
+            selChart = new Vertical3DBarChart();
+        }
+       else if ( currentChart.equals( "Horizontal3DBarChart" ) )
+        {
+            System.out.println( "\n\n Horizontal3DBarChart" );
+            selChart = new Horizontal3DBarChart();
+        }
+        else if ( currentChart.equals( "LineChart" ) )
+        {
+            System.out.println( "\n\n LineChart" );
+            selChart = new LineChart();
+        }
+        else if ( currentChart.equals( "LineAndBarChart" ) )
+        {
+            System.out.println( "\n\n LineAndBarChart" );
+            selChart = new LineAndBarChart();
+        }
+        
+        else if ( currentChart.equals( "AreaChart" ) )
+        {
+            System.out.println( "\n\n AreaChart" );
+            selChart = new AreaChart();
+        }
+/*        else if ( currentChart.equals( "DualAxisChart" ) )
+        {
+            //System.out.println( "DualAxisChart" );
+            selChart = new DualAxisChart();
+        }
+     
+
+        else if ( currentChart.equals( "PieChart3D" ) )
+        {
+            //System.out.println( "PieChart3D" );
+            selChart = new PieChart3D();
+        }
+        else if ( currentChart.equals( "SurveyChart" ) )
+        {
+            //System.out.println( "SurveyChart" );
+            selChart = new SurveyChart();
+        }
+*/ 
+       // chart = selChart.getChartViewer( data1, series1, categories1, chartTitle, xAxis_Title, yAxis_Title );
+        chart = selChart.getChartViewergetChartViewerDataElement( data1, series1, categories1, chartTitle, xAxis_Title, yAxis_Title );
+
+        
+        // Saving chart into Session        
+        ChartRenderingInfo info = null;        
+        try 
+        {
+          info = new ChartRenderingInfo(new StandardEntityCollection());
+          BufferedImage chartImage = chart.createBufferedImage(700, 500, info);
+          session.setAttribute("chartImage", chartImage);
+          
+          session.setAttribute( "headingInfo", headingInfo );
+                    
+        }
+        catch(Exception e)
+        {
+            System.out.println(e.getMessage());
+        }
+
+        return SUCCESS;
+    }// execute end
+
+    
+    public void initializeDataLists()
+    {
+        int i;
+        headingInfo = "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-style: dotted\" bordercolor=\"#111111\" width=\"100%\"><tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">Service Name</td>";
+        
+        for(i=0; i < categories1.length; i++)
+        {
+            headingInfo += "<td class=\"TableHeadingCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+categories1[i]+"</td>";
+        }
+        headingInfo +="</tr>";
+        
+        for(i=0; i<data1.length; i++)
+        {
+            headingInfo += "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"+series1[i]+"</td>";
+            for(int j=0; j<data1[i].length; j++)
+            {
+                headingInfo += "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+data1[i][j]+"</td>";                                         
+            }
+        }
+        
+        headingInfo += "</table>";
+    }
+    
+    public void initialzeAllLists(String[]series1S,  String[] categories1S )
+    
+    {
+        int i;
+        series1 = new String[series1S.length];
+       // series2 = new String[series2S.length];
+        categories1 = new String[categories1S.length];
+       // categories2 = new String[categories2S.length];
+        
+        for(i = 0; i < series1S.length; i++)
+        {
+                series1[i] = series1S[i];
+        }
+/*
+        for(i = 0; i < series2S.length; i++)
+        {
+                series2[i] = series2S[i];
+        }
+*/        
+        for(i = 0; i < categories1S.length; i++)
+        {
+                categories1[i] = categories1S[i];
+        }
+/*       
+        for(i = 0; i < categories2S.length; i++)
+        {
+                categories2[i] = categories2S[i];
+        }
+*/      
+    }
+    
+    public double[][] convertDoubleTodouble( Double[][] objData )
+    {
+        //System.out.println("Before Sorting : ");
+        //double[][] data = new double[series1.length][categories1.length];
+        double[][] data = new double[objData.length][objData[0].length];
+        for ( int i = 0; i < objData.length; i++ )
+        {
+            for ( int j = 0; j < objData[0].length; j++ )
+            {
+               // System.out.println(objData[i][j]);
+                data[i][j] = objData[i][j].doubleValue();
+               // System.out.print(categories1[j]+": "+data[i][j]+", ");                
+            }
+            //System.out.println("");
+        }
+
+        return data;
+    }// convertDoubleTodouble end
+
+    public void sortByAscending()
+    {
+        for(int i=0; i < categories1.length-1 ; i++)
+        {
+                for(int j=0; j < categories1.length-1-i; j++)
+                {
+                        if(data1[0][j] > data1[0][j+1])
+                        {
+                                for(int k=0; k<series1.length; k++)
+                                {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories1[j];
+                                categories1[j] = categories1[j+1];
+                                categories1[j+1] = temp2;
+                        }
+                }
+        }
+/*        
+        for(int i=0; i < categories2.length-1 ; i++)
+        {
+                for(int j=0; j < categories2.length-1-i; j++)
+                {
+                        if(data2[0][j] > data2[0][j+1])
+                        {
+                                for(int k=0; k<series2.length; k++)
+                                {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories2[j];
+                                categories2[j] = categories2[j+1];
+                                categories2[j+1] = temp2;
+                        }
+                }
+        }
+*/        
+    }
+
+    public void sortByDesscending()
+    {
+        for(int i=0; i < categories1.length-1 ; i++)
+        {
+                for(int j=0; j < categories1.length-1-i; j++)
+                {
+                        if(data1[0][j] < data1[0][j+1])
+                        {
+                                for(int k=0; k<series1.length; k++)
+                                {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories1[j];
+                                categories1[j] = categories1[j+1];
+                                categories1[j+1] = temp2;
+                        }
+                }
+        }
+ /*       
+        for(int i=0; i < categories2.length-1 ; i++)
+        {
+                for(int j=0; j < categories2.length-1-i; j++)
+                {
+                        if(data2[0][j] < data2[0][j+1])
+                        {
+                                for(int k=0; k<series2.length; k++)
+                                {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                }
+                                
+                                String temp2 = categories2[j];
+                                categories2[j] = categories2[j+1];
+                                categories2[j+1] = temp2;
+                        }
+                }
+        }
+*/
+    }   
+        public void sortByAlphabet()
+        {
+                for(int i=0; i < categories1.length-1 ; i++)
+                {
+                        for(int j=0; j < categories1.length-1-i; j++)
+                        {
+                                if(categories1[j].compareToIgnoreCase(categories1[j+1]) > 0)
+                                {
+                                        for(int k=0; k<series1.length; k++)
+                                        {
+                                        double temp1 = data1[k][j];
+                                        data1[k][j] = data1[k][j+1];
+                                        data1[k][j+1] = temp1;                                          
+                                        }
+                                        
+                                        String temp2 = categories1[j];
+                                        categories1[j] = categories1[j+1];
+                                        categories1[j+1] = temp2;
+                                }
+                        }
+                }
+                
+/*                for(int i=0; i < categories2.length-1 ; i++)
+                {
+                        for(int j=0; j < categories2.length-1-i; j++)
+                        {
+                                if(categories2[j].compareToIgnoreCase(categories2[j+1]) > 0)
+                                {
+                                        for(int k=0; k<series2.length; k++)
+                                        {
+                                        double temp1 = data2[k][j];
+                                        data2[k][j] = data2[k][j+1];
+                                        data2[k][j+1] = temp1;                                          
+                                        }
+                                        
+                                        String temp2 = categories2[j];
+                                        categories2[j] = categories2[j+1];
+                                        categories2[j+1] = temp2;
+                                }
+                        }
+                }
+ */       
+    }
+
+
+    
+}// class end

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java	2010-11-02 11:35:05 +0000
@@ -26,7 +26,44 @@
  */
 package org.hisp.dhis.dashboard.ga.action.charts;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.amplecode.quick.StatementManager;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.dashboard.util.DataElementChartResult;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.hisp.dhis.period.SixMonthlyPeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
+
 import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
 
 /**
  * @author Mithilesh Kumar Thakur
@@ -36,16 +73,1224 @@
 public class GenerateChartDataElementAction implements Action
 {
    
-    
-    
-    
-    
+    private final String PERIODWISE = "period";
+
+    private final String CHILDREN = "children";
+
+    private final String SELECTED = "random";
+    
+    private final String OPTIONCOMBO = "optioncombo";
+    
+   // private final String ORGUNITGROUP = "orgUnitSelectedRadio";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+   
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private OrganisationUnitGroupService organisationUnitGroupService;
+
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
+    
+    private AggregationService aggregationService;
+
+    public void setAggregationService( AggregationService aggregationService )
+    {
+        this.aggregationService = aggregationService;
+    }
+
+    private DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+/*    
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+*/ 
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+/*
+    private Comparator<DataElement> dataElementComparator;
+
+    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+    {
+        this.dataElementComparator = dataElementComparator;
+    }
+*/    
+    // --------------------------------------------------------------------------
+    // Parameters
+    // --------------------------------------------------------------------------
+    
+    private HttpSession session;
+
+    public HttpSession getSession()
+    {
+        return session;
+    }
+    
+    private List<DataElementCategoryOptionCombo> selectedOptionComboList;
+    
+    private List<Object> selectedServiceList;
+
+    public List<Object> getSelectedServiceList()
+    {
+        return selectedServiceList;
+    }
+    
+    private List<OrganisationUnit> selOUList;
+    
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+/*    
+    private List<String> selectedDataElements;
+    
+    public void setSelectedDataElements( List<String> selectedDataElements )
+    {
+        this.selectedDataElements = selectedDataElements;
+    }
+*/
+    private List<String> selectedDataElements;
+    
+
+    public void setSelectedDataElements( List<String> selectedDataElements )
+    {
+        this.selectedDataElements = selectedDataElements;
+    }
+
+    private String deSelection;
+    
+    public void setDeSelection( String deSelection )
+    {
+        this.deSelection = deSelection;
+    }
+    
+/*
+    private List<String> ougGroupSetCB;
+    
+    public List<String> getOugGroupSetCB()
+    {
+        return ougGroupSetCB;
+    }
+
+    public void setOugGroupSetCB( List<String> ougGroupSetCB )
+    {
+        this.ougGroupSetCB = ougGroupSetCB;
+    }
+*/
+     
+    private String ougGroupSetCB;
+    
+    public void setOugGroupSetCB( String ougGroupSetCB )
+    {
+        this.ougGroupSetCB = ougGroupSetCB;
+    }
+    
+    public String getOugGroupSetCB()
+    {
+        return ougGroupSetCB;
+    }
+   
+    private List<String> orgUnitGroupList;
+    
+
+    public List<String> getOrgUnitGroupList()
+    {
+        return orgUnitGroupList;
+    }
+
+    public void setOrgUnitGroupList( List<String> orgUnitGroupList )
+    {
+        this.orgUnitGroupList = orgUnitGroupList;
+    }
+
+    private String aggDataCB;
+    
+    public void setAggDataCB( String aggDataCB )
+    {
+        this.aggDataCB = aggDataCB;
+    }
+    
+    private List<String> orgUnitListCB;
+    
+    public void setOrgUnitListCB( List<String> orgUnitListCB )
+    {
+        this.orgUnitListCB = orgUnitListCB;
+    }
+    
+    private String categoryLB;
+    
+    public String getCategoryLB()
+    {
+        return categoryLB;
+    }
+
+    public void setCategoryLB( String categoryLB )
+    {
+        this.categoryLB = categoryLB;
+    }
+    
+    private String selectedButton;
+    
+    public String getSelectedButton()
+    {
+        return selectedButton;
+    }
+
+    public void setSelectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+    
+    private String periodTypeLB;
+    
+    public void setPeriodTypeLB( String periodTypeLB )
+    {
+        this.periodTypeLB = periodTypeLB;
+    }
+    
+    private List<String> yearLB;
+
+    public void setYearLB( List<String> yearLB )
+    {
+        this.yearLB = yearLB;
+    }
+
+    private List<String> periodLB;
+
+    public void setPeriodLB( List<String> periodLB )
+    {
+        this.periodLB = periodLB;
+    }
+    
+    private  List<String> periodNames;
+    
+    private List<Date> selStartPeriodList;
+
+    private List<Date> selEndPeriodList;
+    
+    private DataElementChartResult dataElementChartResult;
+    
+    public DataElementChartResult getDataElementChartResult()
+    {
+        return dataElementChartResult;
+    }
+    
+    private OrganisationUnit selectedOrgUnit;
+    
+    private OrganisationUnitGroup selOrgUnitGroup;
+    
+    private List<OrganisationUnit> selOUGroupMemberList = new ArrayList<OrganisationUnit>();
+    //public List<OrganisationUnit> orgUnit;
+    
+//    public List<DataElementCategoryOptionCombo>  decoc ;
+
+/*    
+    String chartTitle ;
+
+    public String getChartTitle()
+    {
+        return chartTitle;
+    }
+
+    String xAxis_Title;
+
+    public String getXAxis_Title()
+    {
+        return xAxis_Title;
+    }
+
+    String yAxis_Title;
+
+    public String getYAxis_Title()
+    {
+        return yAxis_Title;
+    }
+*/    
+    
+    List<String> yseriesList;
+
+    public List<String> getYseriesList()
+    {
+        return yseriesList;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+    
+
+
+
+    @SuppressWarnings( "unchecked" )
     public String execute()  throws Exception
     {
-   
-       
+        statementManager.initialise();
+        selectedOptionComboList = new ArrayList<DataElementCategoryOptionCombo>();
+        
+        selOUList = new ArrayList<OrganisationUnit>();
+        System.out.println( "selected orgUnit  size : " + orgUnitListCB.size() );
+        
+        System.out.println( "selected Year  size : " + yearLB.size());
+        
+      //  System.out.println( "selected Period  size : " + periodLB.size());
+        
+        System.out.println( "selected dataelements : " + selectedDataElements);
+        
+        System.out.println( "selected dataelements size : " + selectedDataElements.size());
+        
+        // int flag = 0;
+        //  selOUList = new ArrayList<OrganisationUnit>();
+        selStartPeriodList = new ArrayList<Date>();
+        selEndPeriodList = new ArrayList<Date>();
+        
+        yseriesList = new ArrayList<String>();
+      //  DataElement dElement = new DataElement();
+        
+       // DataElementCategoryOptionCombo decoc1 = new DataElementCategoryOptionCombo();
+       // int countForServiceList = 0;
+        
+      //  ouChildCountMap = new HashMap<OrganisationUnit, Integer>();
+
+        String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" };
+        int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 };
+
+        /* Period Info */
+
+        String startD = "";
+        String endD = "";
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+
+        periodNames = new ArrayList<String>();
+
+        for ( String year : yearLB )
+        {
+            int selYear = Integer.parseInt( year.split( "-" )[0] );
+
+            if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) )
+            {
+
+                startD = "" + selYear + "-04-01";
+                endD = "" + (selYear + 1) + "-03-31";
+
+                selStartPeriodList.add( format.parseDate( startD ) );
+                selEndPeriodList.add( format.parseDate( endD ) );
+
+                periodNames.add( "" + selYear + "-" + (selYear + 1) );
+
+                continue;
+                
+            }
+           
+            for ( String periodStr : periodLB )
+            {
+                int period = Integer.parseInt( periodStr );
+
+                if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) )
+                {
+                    simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+
+                    if ( period >= 9 )
+                    {
+                        startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01";
+                        endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period];
+
+                        if ( (selYear + 1) % 4 == 0 && period == 10 )
+                        {
+                            endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
+                        }
+                    }
+                    else
+                    {
+                        startD = "" + selYear + "-" + monthOrder[period] + "-01";
+                        endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period];
+                    }
+
+                    selStartPeriodList.add( format.parseDate( startD ) );
+                    selEndPeriodList.add( format.parseDate( endD ) );
+                    periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) );
+                }
+                else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) )
+                {
+                    if ( period == 0 )
+                    {
+                        startD = "" + selYear + "-04-01";
+                        endD = "" + selYear + "-06-30";
+                        periodNames.add( selYear + "-Q1" );
+                    }
+                    else if ( period == 1 )
+                    {
+                        startD = "" + selYear + "-07-01";
+                        endD = "" + selYear + "-09-30";
+                        periodNames.add( selYear + "-Q2" );
+                    }
+                    else if ( period == 2 )
+                    {
+                        startD = "" + selYear + "-10-01";
+                        endD = "" + selYear + "-12-31";
+                        periodNames.add( selYear + "-Q3" );
+                    }
+                    else
+                    {
+                        startD = "" + (selYear + 1) + "-01-01";
+                        endD = "" + (selYear + 1) + "-03-31";
+                        periodNames.add( (selYear) + "-Q4" );
+                    }
+                    selStartPeriodList.add( format.parseDate( startD ) );
+                    selEndPeriodList.add( format.parseDate( endD ) );
+                }
+                else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) )
+                {
+                    if ( period == 0 )
+                    {
+                        startD = "" + selYear + "-04-01";
+                        endD = "" + selYear + "-09-30";
+                        periodNames.add( selYear + "-HY1" );
+                    }
+                    else
+                    {
+                        startD = "" + selYear + "-10-01";
+                        endD = "" + (selYear + 1) + "-03-31";
+                        periodNames.add( selYear + "-HY2" );
+                    }
+                    selStartPeriodList.add( format.parseDate( startD ) );
+                    selEndPeriodList.add( format.parseDate( endD ) );
+                }
+
+                System.out.println( startD + " : " + endD );
+            }
+           
+        }
+        
+        // DataElement Information        
+        
+        List<DataElement> dataElementList = new ArrayList<DataElement>();
+        
+        if ( deSelection == null )
+        {
+            System.out.println( "deOptionValue is null" );
+            return null;
+        }
+        else
+        {
+            //System.out.println( "deOptionValue : " + deSelection );
+        }
+        
+        System.out.println("\n\n\n ===== \n deSelection: " + deSelection);
+        
+       
+        
+        if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+        { 
+           // System.out.println("\n\n\n ===== \n deSelection: OK ");
+            Iterator deIterator = selectedDataElements.iterator();
+            
+          //  dElement = (DataElement) deIterator.next();
+            
+            while ( deIterator.hasNext() )
+            {
+                String serviceId = (String) deIterator.next();
+                String partsOfServiceId[] = serviceId.split( ":" );
+                int dataElementId = Integer.parseInt( partsOfServiceId[0] );
+                DataElement dataElement = dataElementService.getDataElement( dataElementId );
+                // selectedServiceList.add( dataElement );
+                dataElementList.add( dataElement );
+                int optionComboId = Integer.parseInt( partsOfServiceId[1] );
+                DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDataElementCategoryOptionCombo( optionComboId );
+                selectedOptionComboList.add( decoc );
+              //  chartTitle += dataElement.getName() + " : " + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() + ", ";
+              /*  
+                decoc1 = selectedOptionComboList.get( countForServiceList );
+                yseriesList.add( dElement.getName() + " : " + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc1 ).getName() );
+                System.out.println( "Data Elenent name is  : " + dElement.getName() + " categoryOptionCombo is :  " + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc1 ).getName() );
+            */
+            }
+            
+            
+        }
+        else
+        {
+            Iterator deIterator = selectedDataElements.iterator();
+            while ( deIterator.hasNext() )
+            {
+                int serviceID = Integer.parseInt( (String) deIterator.next() );
+                DataElement dataElement = dataElementService.getDataElement( serviceID );
+                // selectedServiceList.add( dataElement );
+                dataElementList.add( dataElement );
+               // chartTitle += dataElement.getName() + ", ";
+             /*   yseriesList.add( dElement.getName() );
+                System.out.println( "Data Elenent name is  : " + dElement.getName() );*/
+            }
+            
+        }
+        //Collections.sort( dataElementList, dataElementComparator );
+        selectedServiceList = new ArrayList<Object>( dataElementList );
+        
+        // OrgUnit Information              
+        
+        for ( String ouStr : orgUnitListCB )
+        {
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( ouStr ) );
+            selOUList.add( orgUnit );
+        }
+
+        Calendar now = Calendar.getInstance();//for mili seconds
+        
+        // calling individual Function 
+        if ( categoryLB.equalsIgnoreCase( PERIODWISE )&& ougGroupSetCB == null )
+        {
+            System.out.println( "Inside PeriodWise Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+           
+            
+            dataElementChartResult = generateChartDataPeriodWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUList.iterator().next() );
+           /* 
+            ActionContext ctx = ActionContext.getContext();
+            HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+
+            session = req.getSession();
+            /*
+            #foreach( )
+                $dataElementChartResult.data[$count1][$count2]
+            #end
+            *//*
+            Integer i = dataElementChartResult.getCategories().length;
+            System.out.println( "\n Categories Length is " + i );
+            
+            Integer j = dataElementChartResult.getSeries().length;
+            System.out.println( "\n Series Length is " + j );
+            
+            session.setAttribute( "data1", dataElementChartResult.getData() );
+            session.setAttribute( "series1", dataElementChartResult.getSeries() );
+            session.setAttribute( "categories1", dataElementChartResult.getCategories() );
+            session.setAttribute( "chartTitle", dataElementChartResult.getChartTitle() );
+            session.setAttribute( "xAxisTitle", dataElementChartResult.getXAxis_Title() );
+            session.setAttribute( "yAxisTitle", dataElementChartResult.getYAxis_Title() );
+           */ 
+
+        }
+        else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB == null )
+        {
+            System.out.println( "Inside Child Wise Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+            
+            selectedOrgUnit = new OrganisationUnit();
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            
+            List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+            childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
+            
+            
+            dataElementChartResult = generateChartDataWithChildrenWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,childOrgUnitList );
+  
+        }
+        else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB == null )
+        {
+            
+            System.out.println( "Inside Selected OrgUnit Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+            
+            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUList );
+          
+        }
+        
+        else if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB != null )
+        {
+            System.out.println( "Inside Period dWise With OrgGroup Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() + "Mili seconds is : " + now.getTimeInMillis() );
+          
+            //finding the common list of selected org unit and selected Group
+            
+            //  selOUList = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+           
+            System.out.println( "oug Group Set is  = " + orgUnitGroupList );
+            
+            selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupList.get( 0 ) ) );
+           // String selOrgGroupname = selOrgUnitGroup.getName();
+            selOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
+            
+           // System.out.println( "Report Generation Start Time is : \t" + new Date() + "Mili seconds is : " + now.getTimeInMillis() );
+           
+           // System.out.println( "Size of Group member is before retain : " + selOUGroupMemberList.size() );
+            
+            selOUGroupMemberList.retainAll( orgUnitChildList );
+            
+           // orgUnitChildList.retainAll( selOUGroupMemberList );
+           /* 
+            System.out.println( "Size of Group member is after retain : " + selOUGroupMemberList.size() );
+            
+            System.out.println( "Report Generation End Time is : \t" + new Date()+ "Mili seconds is : " + now.getTimeInMillis() );
+            
+            System.out.println( "OruUnit: " + selectedOrgUnit.getName() + "Group Name is : " + selOrgUnitGroup.getName() + "Size of Group member after retain is : " + selOUGroupMemberList.size() );
+            
+            System.out.println( "Inside PeriodWise With OrgGroup Chart Data" );
+            */
+          
+           // dataElementChartResult = generateChartDataOrgGroupPeriodWise(selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selectedOrgUnit,selOrgUnitGroup,selOUGroupMemberList);
+            dataElementChartResult = generateChartDataOrgGroupPeriodWise(selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUGroupMemberList);
+ 
+        }
+        
+        else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB != null )
+        {
+            System.out.println( "Inside ChildWise With OrgGroup Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+            
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+            
+            int groupCount = 0;
+            System.out.println("\n\n ++++++++++++++++++++++ \n orgUnitGroup : " + orgUnitGroupList );
+            for ( String orgUnitGroupId : orgUnitGroupList )
+            {
+                OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) );
+               
+                List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
+                
+                selOUGroupMemberList.addAll( selectedOUGroupMemberList );
+
+                System.out.println( "Total Size of " + groupCount + " : " + selOUGroupMemberList.size()  );
+
+                groupCount++;
+    
+            }
+            
+          //  System.out.println( "Total Size of " + selOUGroupMemberList.size()  );
+
+           // System.out.println( "Report Generation Start Time is : \t" + new Date() + "Mili seconds is : " + now.getTimeInMillis() );
+            
+           // System.out.println( "Size of Group member is before retain : " + selOUGroupMemberList.size() + " ,Size of Child Member is :" + orgUnitChildList.size() );
+            
+            selOUGroupMemberList.retainAll( orgUnitChildList );
+            
+           // System.out.println( "Report Generation End Time is : \t" + new Date()+ "Mili seconds is : " + now.getTimeInMillis() );
+            
+           // System.out.println( "OruUnit: " + selectedOrgUnit.getName() + " Group Size is : " + orgUnitGroupList.size() + " ,Size of Group member after retain is : " + selOUGroupMemberList.size() );
+            // generateChartDataOrgGroupChildWise();
+            
+            // calling sane function in case of SelectedOrgUnit Chart Data
+            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUGroupMemberList );
+            
+
+        }
+        
+        else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB != null )
+        {
+            System.out.println( "Inside Selected With OrgGroup Chart Data" );
+            System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+            
+            Map<OrganisationUnitGroup,List<OrganisationUnit>> orgUnitGroupMap = new HashMap<OrganisationUnitGroup,List<OrganisationUnit>>();
+           
+            System.out.println( "Inside SelectedOrgUnit With OrgGroup Chart Data" );
+           
+           selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+           List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+           
+           for ( String orgUnitGroupId : orgUnitGroupList )
+           {
+               OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) );
+               List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
+               
+               selectedOUGroupMemberList.retainAll( orgUnitChildList );
+               
+               orgUnitGroupMap.put( selOrgUnitGroup,  selectedOUGroupMemberList);
+               //selOUGroupMemberList.addAll( selectedOUGroupMemberList );
+           }
+           
+          // System.out.println( "selOrgUnitGroup Size is : " + orgUnitGroupMap.keySet().size()  );
+          
+           dataElementChartResult = generateChartDataSelectedOrgUnitGroupWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,orgUnitGroupMap );
+
+        }
+       
+        ActionContext ctx = ActionContext.getContext();
+        HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+
+        session = req.getSession();
+        
+        session.setAttribute( "data1", dataElementChartResult.getData() );
+        session.setAttribute( "series1", dataElementChartResult.getSeries() );
+        session.setAttribute( "categories1", dataElementChartResult.getCategories() );
+        session.setAttribute( "chartTitle", dataElementChartResult.getChartTitle() );
+        session.setAttribute( "xAxisTitle", dataElementChartResult.getXAxis_Title() );
+        session.setAttribute( "yAxisTitle", dataElementChartResult.getYAxis_Title() );
+        
+        System.out.println( "Chart Generation End Time is : \t" + new Date() );
+        statementManager.destroy();
         return SUCCESS;
     }
     // execute end
+    
+    // Supporting Methods
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data only Period Wise start
+    // -------------------------------------------------------------------------
+    
+   
+    public DataElementChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,OrganisationUnit orgUnit ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       String[] series = new String[dataElementList.size()];
+       String[] categories = new String[selStartPeriodList.size()];
+       Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
+       String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+       String xAxis_Title = "Time Line";
+       String yAxis_Title = "Value";
+    
+      // System.out.println("\n\n +++ \n decoc : " + decocList);
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               decoc = decocList.get( serviceCount );
+                   
+               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+           }
+           else
+           {
+               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+               series[serviceCount] = dataElement.getName();
+               
+               yseriesList.add( dataElement.getName() );
+           }
+           
+           int periodCount = 0;
+           for( Date startDate : selStartPeriodList )
+           {
+               Date endDate = selEndPeriodList.get( periodCount );
+                              
+               categories[periodCount] = periodNames.get( periodCount );
+               
+               Double aggDataValue = 0.0;
+               if( aggDataCB != null )
+               {
+                   aggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
+                   //System.out.println( "Agg data value before is  : " + aggDataValue );
+                   if(aggDataValue == null ) aggDataValue = 0.0;
+                   //System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+               }
+               else
+               {
+                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   
+                   for( Period period : periods )
+                   {
+                       DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                       
+                       try
+                       {
+                           aggDataValue += Double.parseDouble( dataValue.getValue() );
+                       }
+                       catch( Exception e )
+                       {
+                           
+                       }
+                   }
+               }
+               
+               data[serviceCount][periodCount] = aggDataValue;
+               
+               periodCount++;
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       return dataElementChartResult;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data only Period Wise end
+    // -------------------------------------------------------------------------
+    
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With Children Wise start
+    // -------------------------------------------------------------------------
+        
+    public DataElementChartResult generateChartDataWithChildrenWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> childOrgUnitList ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       String[] series = new String[dataElementList.size()];
+       String[] categories = new String[childOrgUnitList.size()];
+       Double[][] data = new Double[dataElementList.size()][childOrgUnitList.size()];
+       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
+       
+      // String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+       String xAxis_Title = "Facilities";
+       String yAxis_Title = "Value";
+    
+      // System.out.println("\n\n +++ \n decoc : " + decocList);
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               decoc = decocList.get( serviceCount );
+                   
+               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+           }
+           else
+           {
+               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+               series[serviceCount] = dataElement.getName();
+               
+               yseriesList.add( dataElement.getName() );
+           }
+           
+           int childCount = 0;
+           for( OrganisationUnit orgChild : childOrgUnitList )
+           {
+                          
+               categories[childCount] = orgChild.getName();
+               
+               Double aggDataValue = 0.0;
+
+               int periodCount = 0;
+               for( Date startDate : selStartPeriodList )
+               {
+                   Date endDate = selEndPeriodList.get( periodCount );
+                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   
+                   for( Period period : periods )
+                   {
+                           
+                       if( aggDataCB != null )
+                       {
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgChild );
+                          // System.out.println( "Agg data value before is  : " + aggDataValue );
+                          
+                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                          // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                       }
+                       else
+                       {
+                               DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                        
+                       }
+                   }
+                   periodCount++;
+               }
+ 
+               data[serviceCount][childCount] = aggDataValue;
+               childCount++;
+            
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       return dataElementChartResult;
+    }
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With Children Wise end
+    // -------------------------------------------------------------------------
+    
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With Selected Wise start
+    // -------------------------------------------------------------------------
+        
+    public DataElementChartResult generateChartDataSelectedOrgUnitWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> selOUList ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       String[] series = new String[dataElementList.size()];
+       String[] categories = new String[selOUList.size()];
+       Double[][] data = new Double[dataElementList.size()][selOUList.size()];
+       String chartTitle = "OrganisationUnit : -----" ;
+       
+      // String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+       String xAxis_Title = "Facilities";
+       String yAxis_Title = "Value";
+    
+      // System.out.println("\n\n +++ \n decoc : " + decocList);
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               decoc = decocList.get( serviceCount );
+                   
+               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+           }
+           else
+           {
+               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+               series[serviceCount] = dataElement.getName();
+               
+               yseriesList.add( dataElement.getName() );
+           }
+           
+           int orgUnitCount = 0;
+           for( OrganisationUnit orgunit : selOUList )
+           {             
+               categories[orgUnitCount] = orgunit.getName();
+               
+               Double aggDataValue = 0.0;
+
+               int periodCount = 0;
+               for( Date startDate : selStartPeriodList )
+               {
+                   Date endDate = selEndPeriodList.get( periodCount );
+                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   
+                   for( Period period : periods )
+                   {
+                           
+                       if( aggDataCB != null )
+                       {
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgunit );
+                           //System.out.println( "Agg data value before is  : " + aggDataValue );
+                          
+                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                          // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                       }
+                       else
+                       {
+                         
+                               DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                          
+                       }
+                   }
+                   periodCount++;
+               }
+ 
+               data[serviceCount][orgUnitCount] = aggDataValue;
+               orgUnitCount++;
+             
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       return dataElementChartResult;
+    }
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With Selected Wise end 
+    // -------------------------------------------------------------------------
+        
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data OrgGroup Period Wise start
+    // -------------------------------------------------------------------------
+       
+    public DataElementChartResult generateChartDataOrgGroupPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> selOUGroupMemberList ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       String[] series = new String[dataElementList.size()];
+       String[] categories = new String[selStartPeriodList.size()];
+       Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
+       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName()+ "(" + selOrgUnitGroup.getName() +  ")";
+       String xAxis_Title = "Time Line";
+       String yAxis_Title = "Value";
+       
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               decoc = decocList.get( serviceCount );
+                   
+               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+           }
+           else
+           {
+               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+               series[serviceCount] = dataElement.getName();
+               
+               yseriesList.add( dataElement.getName() );
+           }
+               
+               Double aggDataValue = 0.0;
+              
+               int periodCount = 0;
+               for( Date startDate : selStartPeriodList )
+               {
+                   Date endDate = selEndPeriodList.get( periodCount );
+                   categories[periodCount] = periodNames.get( periodCount );
+                   
+                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+  
+                   for( Period period : periods )
+                   {
+                       int orgGroupCount = 0;
+                       
+                       for( OrganisationUnit orgUnit : selOUGroupMemberList )
+                       {
+                           
+                           if( aggDataCB != null )
+                           {
+                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgUnit );
+                              // System.out.println( "Agg data value before is  : " + aggDataValue );
+                              
+                               if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                              // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                           }
+                       else
+                       {
+                       
+                               DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                          
+                       }
+                          orgGroupCount++;
+                   }
+                   
+                   
+               }
+   
+               data[serviceCount][periodCount] = aggDataValue;
+               periodCount++;    
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       
+      return dataElementChartResult;
+    
+   }
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data OrgGroup Period Wise end 
+    // -------------------------------------------------------------------------
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data OrgGroup Selected orgUnit Wise start
+    // -------------------------------------------------------------------------
+       
+    public DataElementChartResult generateChartDataSelectedOrgUnitGroupWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,Map<OrganisationUnitGroup,List<OrganisationUnit>> orgUnitGroupMap ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       String[] series = new String[dataElementList.size()];
+       String[] categories = new String[orgUnitGroupMap.keySet().size()];
+       Double[][] data = new Double[dataElementList.size()][orgUnitGroupMap.keySet().size()];
+       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName() +" - ";
+       String xAxis_Title = "Organisation Unit Group";
+       String yAxis_Title = "Value";
+       
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               decoc = decocList.get( serviceCount );
+                   
+               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+           }
+           else
+           {
+               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+               series[serviceCount] = dataElement.getName();
+               
+               yseriesList.add( dataElement.getName() );
+           }
+           
+                       int orgGroupCount = 0;
+                      // int orgGroupCount1 = 0;
+                       Double aggDataValue = 0.0;
+                       
+                       for( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
+                       {
+                          // Double aggDataValue = 0.0;
+                           categories[orgGroupCount] = orgUnitGroup.getName();
+                           
+                           if( serviceCount == 0 )
+                           {
+                               chartTitle += orgUnitGroup.getName() + ",";
+                           }
+                           Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroup.getMembers();
+                           if( orgUnitGroupMembers == null || orgUnitGroupMembers.size() == 0 )
+                           {
+                               data[serviceCount][orgGroupCount] = aggDataValue;
+                               orgGroupCount++;
+                               continue;
+                           }
+                           for( OrganisationUnit orgUnit : orgUnitGroup.getMembers() )
+                           {
+                               
+                               int periodCount = 0;
+                               for( Date startDate : selStartPeriodList )
+                               {
+                                   Date endDate = selEndPeriodList.get( periodCount );
+                                 
+                                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                                                                  
+                                      for( Period period : periods )
+                                      {
+                                      
+                                           if( aggDataCB != null )
+                                           {
+                                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgUnit );
+                                             //  System.out.println( "Agg data value before is  : " + aggDataValue );
+                                              
+                                               if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                                              // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                                           }
+                                           else
+                                           {
+                                                   DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                                                   
+                                                   try
+                                                   {
+                                                       aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                                   }
+                                                   catch( Exception e )
+                                                   {
+                                                       
+                                                   }
+                                           }
+                               
+                                      }
+                          periodCount++;  
+                 }  
+                      
+               }
+                   
+               data[serviceCount][orgGroupCount] = aggDataValue;
+              
+               orgGroupCount++;
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       
+      return dataElementChartResult;
+    
+   }
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data OrgGroup Selected orgUnit Wise end
+    // -------------------------------------------------------------------------        
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/AreaChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/AreaChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/AreaChart.java	2010-11-02 11:35:05 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.ChartFactory;
@@ -134,4 +133,75 @@
                       
         return chart;
     }// getChartViewer end
+    // getChartViewer DataElement wise method
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        System.out.println("\n inside Area chart");
+        DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createAreaChart( "", // chart
+            // title
+            "Category", // domain axis label
+            "Value", // range axis label
+            dataset1, // data
+            PlotOrientation.VERTICAL, // orientation
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "Area Chart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( subtitle );
+
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setForegroundAlpha( 0.5f );
+        plot.setNoDataMessage( "No data to display" );
+
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+        */
+                      
+        return chart;
+    }// getChartViewer DataElement wise end
+    
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/DualAxisChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/DualAxisChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/DualAxisChart.java	2010-11-02 11:35:05 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.ChartFactory;
@@ -43,10 +42,12 @@
 import org.jfree.chart.plot.CategoryPlot;
 import org.jfree.chart.plot.DatasetRenderingOrder;
 import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
 import org.jfree.chart.renderer.category.LineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.category.CategoryDataset;
 import org.jfree.data.category.DefaultCategoryDataset;
+import org.jfree.ui.HorizontalAlignment;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.ui.TextAnchor;
 import org.jfree.ui.VerticalAlignment;
@@ -146,5 +147,76 @@
       
         return chart;
     }// getChartViewer end
+    
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createBarChart3D( "", // chart
+            // title
+            "Category", // domain axis label
+            "Value", // range axis label
+            dataset1, // data
+            PlotOrientation.VERTICAL, // orientation
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "3D BarChart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setHorizontalAlignment( HorizontalAlignment.CENTER );
+        chart.addSubtitle( subtitle );
+
+        // get a reference to the plot for further customisation...
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setNoDataMessage( "No data to display" );
+
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+         
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+         */
+
+        return chart;
+    }// getChartViewer DataElement wise end
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Horizontal3DBarChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Horizontal3DBarChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Horizontal3DBarChart.java	2010-11-02 11:35:05 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.ChartFactory;
@@ -135,4 +134,75 @@
 
         return chart;
     }// getChartViewer end
+    
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        System.out.println("\n inside Horizantal 3 d Bar chart chart");
+        DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createBarChart3D( "", // chart
+            // title
+            "Category", // domain axis label
+            "Value", // range axis label
+            dataset1, // data
+            PlotOrientation.HORIZONTAL, // orientation
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "3D BarChart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( subtitle );
+
+        // get a reference to the plot for further customisation...
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setNoDataMessage( "No data to display" );
+        
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+        */
+
+        return chart;
+    }// getChartViewer DataElement wise end
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineAndBarChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineAndBarChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineAndBarChart.java	2010-11-02 11:35:05 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.JFreeChart;
@@ -126,5 +125,64 @@
 
         return chart;
     }// getChartViewer end
+    
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        System.out.println("\n inside Line and bar chart");
+        final CategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        final NumberAxis rangeAxis1 = new NumberAxis( yAxis_Title );
+        rangeAxis1.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis1.setUpperMargin( 0.15 );
+        rangeAxis1.setLowerMargin( 0.15 );
+
+        final LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
+        renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() );
+        renderer1.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer1.setItemLabelsVisible( true );
+        final CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 );
+        subplot1.setDomainGridlinesVisible( true );
+
+        final CategoryDataset dataset2 = getDataset( data1, series1, categories1 );
+        final NumberAxis rangeAxis2 = new NumberAxis( yAxis_Title );
+        rangeAxis2.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis2.setUpperMargin( 0.30 );
+        rangeAxis1.setLowerMargin( 0.30 );
+
+        final BarRenderer renderer2 = new BarRenderer();
+        renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() );
+        renderer2.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer2.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        renderer2.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer2.setItemLabelsVisible( true );
+        final CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 );
+        subplot2.setDomainGridlinesVisible( true );
+
+        final CategoryAxis domainAxis = new CategoryAxis( xAxis_Title );
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+
+        final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot( domainAxis );
+        plot.setNoDataMessage( "No data to display" );
+        plot.add( subplot1, 2 );
+        plot.add( subplot2, 1 );
+
+        final JFreeChart chart = new JFreeChart( "", new Font( "SansSerif", Font.BOLD, 12 ), plot, true );
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "Combined (Line and Bar) Chart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( subtitle );
+        
+        return chart;
+    }// getChartViewer DataElement wise end
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/LineChart.java	2010-11-02 11:35:05 +0000
@@ -126,5 +126,71 @@
 
         return chart;
     }// getChartViewer end
+    
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+       System.out.println("\n inside Line chart");
+       DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+
+       // create the first plot...
+       final CategoryItemRenderer renderer = new LineAndShapeRenderer();        
+       renderer.setToolTipGenerator( new StandardCategoryToolTipGenerator() );
+       renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+       renderer.setItemLabelsVisible( true );
+       
+
+       final CategoryPlot plot = new CategoryPlot();
+       plot.setNoDataMessage( "No data to display" );
+       plot.setDataset( dataset1 );
+       plot.setRenderer( renderer );
+
+       plot.setDomainAxis( new CategoryAxis( xAxis_Title ) );
+       plot.setRangeAxis( new NumberAxis( yAxis_Title ) );
+
+       plot.setOrientation( PlotOrientation.VERTICAL );
+       plot.setRangeGridlinesVisible( true );
+       plot.setDomainGridlinesVisible( true );
+       
+
+       // customise the range axis...
+       final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+       rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+       rangeAxis.setAutoRangeIncludesZero( true );
+       rangeAxis.setUpperMargin( 0.15 );
+       rangeAxis.setLowerMargin( 0.15 );
+
+       /*
+       final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+       final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+       renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+       renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+       plot.setDataset( 1, dataset2 );
+       plot.setRenderer( 1, renderer2 );
+       plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+       */
+
+       final JFreeChart chart = new JFreeChart( plot );
+
+       /* TITLE */
+       final TextTitle mainTitle = new TextTitle( "Line Chart" );
+       mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+       mainTitle.setPosition( RectangleEdge.TOP );
+       mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+       chart.addSubtitle( mainTitle );
+
+       /* SUB TITLE */
+       final TextTitle subtitle = new TextTitle( chartTitle );
+       subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+       subtitle.setPosition( RectangleEdge.TOP );
+       subtitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+       chart.addSubtitle( subtitle );
+
+       final CategoryAxis domainAxis = plot.getDomainAxis();
+       domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+
+       return chart;
+    }// getChartViewer DataElement wise end
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/PieChart3D.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/PieChart3D.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/PieChart3D.java	2010-11-02 11:35:05 +0000
@@ -31,10 +31,20 @@
 
 import org.jfree.chart.ChartFactory;
 import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.labels.ItemLabelAnchor;
+import org.jfree.chart.labels.ItemLabelPosition;
+import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
+import org.jfree.chart.plot.CategoryPlot;
 import org.jfree.chart.plot.PiePlot3D;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.general.DefaultPieDataset;
+import org.jfree.ui.HorizontalAlignment;
 import org.jfree.ui.RectangleEdge;
+import org.jfree.ui.TextAnchor;
 import org.jfree.ui.VerticalAlignment;
 import org.jfree.util.Rotation;
 
@@ -89,5 +99,74 @@
 
         return chart;
     }// getChartViewer end
+    
+    
+    // getChartViewer DataElement wise method
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        DefaultPieDataset dataset1 = getDataset( data1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createPieChart3D( "", // chart
+            dataset1, // data
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "3D BarChart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setHorizontalAlignment( HorizontalAlignment.CENTER );
+        chart.addSubtitle( subtitle );
+
+        // get a reference to the plot for further customisation...
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setNoDataMessage( "No data to display" );
+
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+         
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+         */
+
+        return chart;
+    }// getChartViewer DataElement wise end
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/StandardChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/StandardChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/StandardChart.java	2010-11-02 11:35:05 +0000
@@ -33,4 +33,6 @@
 {
     JFreeChart getChartViewer( double[][] data1, String[] series1, String[] categories1, double[][] data2, String[] series2,
         String[] categories2, String chartTitle, String xAxis_Title, String yAxis_Title );
+    
+    JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title );
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/SurveyChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/SurveyChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/SurveyChart.java	2010-11-02 11:35:05 +0000
@@ -1,7 +1,6 @@
 package org.hisp.dhis.dashboard.ga.charts;
 
 import java.awt.BasicStroke;
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.ChartFactory;
@@ -20,6 +19,7 @@
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.category.CategoryDataset;
 import org.jfree.data.category.DefaultCategoryDataset;
+import org.jfree.ui.HorizontalAlignment;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.ui.TextAnchor;
 import org.jfree.ui.VerticalAlignment;
@@ -109,4 +109,77 @@
 
         return chart;
     }// getChartViewer end
+    
+    
+    // getChartViewer DataElement wise method
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createBarChart3D( "", // chart
+            // title
+            "Category", // domain axis label
+            "Value", // range axis label
+            dataset1, // data
+            PlotOrientation.VERTICAL, // orientation
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "3D BarChart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setHorizontalAlignment( HorizontalAlignment.CENTER );
+        chart.addSubtitle( subtitle );
+
+        // get a reference to the plot for further customisation...
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setNoDataMessage( "No data to display" );
+
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+         
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+         */
+
+        return chart;
+    }// getChartViewer DataElement wise end
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Vertical3DBarChart.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Vertical3DBarChart.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Vertical3DBarChart.java	2010-11-02 11:35:05 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.awt.Color;
 import java.awt.Font;
 
 import org.jfree.chart.ChartFactory;
@@ -138,4 +137,78 @@
 
         return chart;
     }// getChartViewer end
+    
+    // getChartViewer DataElement wise method
+    @SuppressWarnings("deprecation")
+    public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
+    {
+        DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+        // create the chart...
+        final JFreeChart chart = ChartFactory.createBarChart3D( "", // chart
+            // title
+            "Category", // domain axis label
+            "Value", // range axis label
+            dataset1, // data
+            PlotOrientation.VERTICAL, // orientation
+            true, // include legend
+            true, // tooltips?
+            false // URLs?
+            );
+
+        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+
+        /* TITLE */
+        final TextTitle mainTitle = new TextTitle( "3D BarChart" );
+        mainTitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        mainTitle.setPosition( RectangleEdge.TOP );
+        mainTitle.setVerticalAlignment( VerticalAlignment.BOTTOM );
+        chart.addSubtitle( mainTitle );
+
+        /* SUB TITLE */
+        final TextTitle subtitle = new TextTitle( chartTitle );
+        subtitle.setFont( new Font( "times", Font.BOLD, 13 ) );
+        subtitle.setPosition( RectangleEdge.TOP );
+        subtitle.setHorizontalAlignment( HorizontalAlignment.CENTER );
+        chart.addSubtitle( subtitle );
+
+        // get a reference to the plot for further customisation...
+        final CategoryPlot plot = chart.getCategoryPlot();
+        plot.setNoDataMessage( "No data to display" );
+
+        // set the range axis to display integers only...
+        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+        rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
+        rangeAxis.setUpperMargin( 0.15 );
+        rangeAxis.setLowerMargin( 0.15 );
+        rangeAxis.setLabel( yAxis_Title );
+
+
+        // disable bar outlines...
+        final CategoryItemRenderer renderer = plot.getRenderer();
+        renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator() );
+        renderer.setItemLabelFont (new Font ("Bold", Font.BOLD, 10));
+        
+        renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER) );
+        renderer.setItemLabelsVisible( true );
+         
+        final CategoryAxis domainAxis = plot.getDomainAxis();
+        domainAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+        domainAxis.setLabel( xAxis_Title );
+
+        // For Line Chart - ie for Target Line
+        /*
+        final CategoryDataset dataset2 = getDataset( data2, series2, categories2 );
+
+        final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
+        renderer2.setSeriesStroke( 0, new BasicStroke( 2.0f ) );
+        renderer2.setSeriesStroke( 1, new BasicStroke( 2.0f ) );
+        plot.setDataset( 1, dataset2 );
+        plot.setRenderer( 1, renderer2 );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+         */
+
+        return chart;
+    }// getChartViewer DataElement wise end
 }
+
+

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-09-27 10:33:48 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-11-02 11:35:05 +0000
@@ -305,6 +305,7 @@
 
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
 
+       
         periodNames = new ArrayList<String>();
 
         for ( String year : yearLB )

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DataElementChartResult.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DataElementChartResult.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DataElementChartResult.java	2010-11-02 11:35:05 +0000
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+package org.hisp.dhis.dashboard.util;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DataElementChartResult.java Oct 26, 2010 2:00:48 PM
+ */
+public class DataElementChartResult 
+{
+  
+    //-------------------------------------------------------------------------
+    // Constructor
+    //-------------------------------------------------------------------------
+    
+    public DataElementChartResult()
+    {
+        
+    }
+    
+    public DataElementChartResult( String[] series, String[] categories, Double data[][],String chartTitle,String xAxis_Title,String yAxis_Title )
+    {
+        this.series = series;
+        this.categories = categories;
+        this.data = data;
+        this.chartTitle = chartTitle;
+        this.xAxis_Title = xAxis_Title;
+        this.yAxis_Title = yAxis_Title;
+        //this.xseriesList = xseriesList;
+        //this.yseriesList = yseriesList;
+    }
+    //---------------------------------------------------------------
+    // Getters and Setters
+    //---------------------------------------------------------------
+
+    
+   private String[] series;
+
+    public String[] getSeries()
+    {
+        return series;
+    }
+
+    public void setSeries( String[] series )
+    {
+        this.series = series;
+    }
+    
+    private String[] categories;
+
+    public String[] getCategories()
+    {
+        return categories;
+    }
+
+    public void setCategories( String[] categories )
+    {
+        this.categories = categories;
+    }
+    
+    Double data[][];
+
+    public Double[][] getData()
+    {
+        return data;
+    }
+
+    public void setData( Double[][] data )
+    {
+        this.data = data;
+    }
+    
+    private String chartTitle;
+
+    public String getChartTitle()
+    {
+        return chartTitle;
+    }
+
+    public void setChartTitle( String chartTitle )
+    {
+        this.chartTitle = chartTitle;
+    }
+    
+    private String xAxis_Title;
+
+    public String getXAxis_Title()
+    {
+        return xAxis_Title;
+    }
+
+    public void setXAxis_Title( String axis_Title )
+    {
+        xAxis_Title = axis_Title;
+    }
+     private String yAxis_Title;
+
+    public String getYAxis_Title()
+    {
+        return yAxis_Title;
+    }
+
+    public void setYAxis_Title( String axis_Title )
+    {
+        yAxis_Title = axis_Title;
+    }
+    
+    
+    /*
+    List<String> xseriesList;
+    
+    public List<String> getXseriesList()
+    {
+        return xseriesList;
+    }
+
+    public void setXseriesList( List<String> xseriesList )
+    {
+        this.xseriesList = xseriesList;
+    }
+
+    List<String> yseriesList;
+
+    public List<String> getYseriesList()
+    {
+        return yseriesList;
+    }
+
+    public void setYseriesList( List<String> yseriesList )
+    {
+        this.yseriesList = yseriesList;
+    }
+ */
+}

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-11-02 11:35:05 +0000
@@ -40,14 +40,42 @@
         </property>
 		
     </bean>
-
+<!-- Graphical Analyser DataElements Result -->
     <bean id="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartDataElementAction"
         class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartDataElementAction"
         scope="prototype">
+		
+		<property name="statementManager" ref="statementManager"/>
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService">
+		</property>
+		<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+		</property>
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+		</property>
+        <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService">
+        </property>		
+		<property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService">
+		</property>
+		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService">
+		</property>
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService">
+		</property>
+    </bean>
+    
+	<!-- for Chart Display -->	
+	<bean id="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartAction1"
+        class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartAction1"
+        scope="prototype">
+    </bean>
+	
+	<!-- Export Data Elements to Excel -->
+    <bean id="org.hisp.dhis.dashboard.action.ExportDataElementToExcelAction"
+        class="org.hisp.dhis.dashboard.action.ExportDataElementToExcelAction"
+        scope="prototype">
 
+        <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
+        </property>
     </bean>
-    	
-	
 <!-- -->	
 	
 		
@@ -742,7 +770,11 @@
         </property>
     </bean>
 	
-
+	<!-- DashBoard Utilities DataElementChartResult-->
+	
+	<bean id="org.hisp.dhis.dashboard.util.DataElementChartResult"
+		class="org.hisp.dhis.dashboard.util.DataElementChartResult" scope="prototype">
+	</bean>
   
 	<!-- TopTen Disease Analysis -->
     <bean

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-11-02 11:35:05 +0000
@@ -34,13 +34,34 @@
 		      
 		<action name="generateChartDataElement"
             class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartDataElementAction">
-            <result name="success" type="velocity">
-                /dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</result>
-            <param name="javascripts">
-                ../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ga.js,javascript/hashtable.js,javascript/gadataelement.js</param>
+			<result name="success" type="velocity">/popup.vm</result>      
+			 <param name="page">/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</param>    
+           <!--<result name="success" type="velocity">/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</result>-->
+            <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ga.js,javascript/hashtable.js,javascript/gadataelement.js</param>
             <param name="stylesheets">css/StylesForTags.css</param>
             <interceptor-ref name="organisationUnitTreeStack"/>
         </action>
+		<!-- for Chart data -->
+	   <action name="generateChart1"
+            class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartAction1">
+            <result name="success" type="chart">
+                <param name="width">700</param>
+                <param name="height">500</param>
+            </result>
+        </action>
+		
+		<!-- Export Data Elements to Excel -->
+        <action name="exportDataElementsToExcel"
+            class="org.hisp.dhis.dashboard.action.ExportDataElementToExcelAction">
+            <result name="success" type="stream">
+                <param name="contentType">application/vnd.ms-excel</param>
+                <param name="inputName">inputStream</param>
+                <param name="contentDisposition">filename="${fileName}"</param>
+                <param name="bufferSize">1024</param>
+            </result>
+        </action>
+		
+		
 <!--	-->			
 		<!-- GraphicalAnalyser Module Stuff -->
 		

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm	2010-11-02 11:35:05 +0000
@@ -1,7 +1,7 @@
 
 <html>
 <head>
-<title>Anual Analysis Result Screen</title>
+<title>Annual Analysis Result Screen</title>
 <link type="text/css" rel="stylesheet" media="screen" href="css/StylesForTags.css">
 <script>
   var indexForChart = 0;

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css	2010-11-02 11:35:05 +0000
@@ -65,7 +65,8 @@
     font-family: arial, georgia, tahoma;
     font-size: 11px;   
     white-space: nowrap;
-    cursor: default;     
+    cursor: default;   
+    border:1px dotted #C0C0C0;  
 }
 
 .DefaultFontStyles {

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm	2010-11-02 11:35:05 +0000
@@ -90,7 +90,7 @@
       &nbsp;&nbsp;<input type="button" value="&lt;&lt;" style="width:40px" onClick="moveAllById( 'selectedDataElements', 'availableDataElements' )">&nbsp;&nbsp;
       </td>
       <td class="NormalB"> $i18n.getString( "ga_selected_delist" )<br />
-        <select multiple size="7" id="selectedDataElements" name="selectedDataElements" disabled style="width:325px; height:100px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
+        <select multiple size="7" id="selectedDataElements" name="selectedDataElements" style="width:325px; height:100px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
         </select>
       </td>
     </tr>
@@ -101,7 +101,7 @@
     </tr>
 
     <tr>
-      <td class="NormalB"><br><input type="checkbox" id="aggDataCB" name="aggDataCB" >$i18n.getString( "ga_aggregated_data" )</td>
+      <td class="NormalB"><br><input type="checkbox"  id="aggDataCB" name="aggDataCB" checked="true" >$i18n.getString( "ga_aggregated_data" )</td>
       <td class="NormalB">&nbsp;</td>
       <td class="NormalB"><br>
 	      <table>
@@ -138,7 +138,7 @@
 	            </select>                       
 	        </td>
 	        <td class="NormalB"><input type="checkbox" id="ougGroupSetCB" name="ougGroupSetCB" onChange="getOrgUnitGroupsDataElements()"  disabled="true">$i18n.getString( "ga_orgUnitGroups" )<br>
-	            <select name="orgUnitGroup" id="orgUnitGroup" multiple size="7"  onChange="selectSingleOptionOrgUnitGroup()"  style="width: 150px;" disabled="true">
+	            <select name="orgUnitGroupList" id="orgUnitGroupList" multiple size="7"  onChange="selectSingleOptionOrgUnitGroup()"  style="width: 150px;" disabled="true">
 	            </select>
 	        </td>
 	    </tr>
@@ -166,10 +166,10 @@
             </td>
           </tr>
           <tr>
-            <td><input type="submit" name="ViewChart" value="$i18n.getString( 'ga_viewchart' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction('ViewChart')">
+            <td><input type="submit" name="ViewChart" value="$i18n.getString( 'ga_viewchart' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction1('ViewChart')">
             </td>
             <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-            <td align="right"><input type="submit" name="ViewSummary" value="$i18n.getString( 'ga_viewsummary' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction('ViewSummary')">
+            <td align="right"><input type="submit" name="ViewSummary" value="$i18n.getString( 'ga_viewsummary' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction1('ViewSummary')">
             </td>
           </tr>
           <input type="hidden" name="selectedButton" id="selectedButton">

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2010-11-02 11:35:05 +0000
@@ -1,73 +1,48 @@
 
-
-<html>
-<head>
-<title>Chart Result Screen</title>
-<link type="text/css" rel="stylesheet" href="css/StylesForTags.css">
-<script type="text/javascript" src="../dhis-web-commons/request.js"></script>
-<script type="text/javascript" src="javascript/lists.js"></script>
-<script type="text/javascript" src="javascript/ga.js"></script>
-<script type="text/javascript" src="javascript/hashtable.js"></script>
-
 <script>
- 
-  var indexForChart = 0;
-  var chartNamesToView = new Array();
-  chartNamesToView[0] = new Array("Nothing");
-  chartNamesToView[1] = new Array("Vertical3DBarChart","Horizontal3DBarChart","LineChart","LineAndBarChart","DualAxisChart","AreaChart","PieChart3D");  
-  chartNamesToView[2] = new Array("Vertical3DBarChart","Horizontal3DBarChart","LineChart","LineAndBarChart","DualAxisChart","AreaChart");                                                   
-  
+
   function drillDownResult(evt, selVal )
   {
     evt.target.href = "drillDownResult.action?selectedValues="+selVal;
   }
     
-  function nextCharttoView()
-   {         
-     indexForChart++;
-     var chartType = 0;
-     var tempICount = $selectedServiceList.size();
-     if(tempICount==0)  chartType=0;
-     else if(tempICount==1) chartType=1;
-     else chartType=2;
+// Chart Display Option change start
 
+  function chartTypeOptionChange(evt)
+   {
+     
+     
+     var chartTypeOptionList = document.getElementById("chartTypeOption");
+     var chartTypeOptionValue = chartTypeOptionList.options[ chartTypeOptionList.selectedIndex ].value;
+     
+    // var tempICount = $selectedServiceList.size();
+    
+    // alert(chartTypeOptionValue);
+     
      var chartDisplayOptionList = document.getElementById("chartDisplayOption");
      var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
-   
-     if(indexForChart >= chartNamesToView[chartType].length) indexForChart=0;
-     iframeForChart.location.href = "generateChart.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;
+     
+    // alert(chartDisplayOptionValue);   
+
+     iframeForChart.location.href = "generateChart1.action?currentChart="+chartTypeOptionValue+"&chartDisplayOption="+chartDisplayOptionValue;
+     
    }
-   
-   function prevCharttoView()
-   {      
-     indexForChart--;
-     var chartType = 0;
-     var tempICount = $selectedServiceList.size();
-     if(tempICount==0)  chartType=0;
-     else if(tempICount==1) chartType=1;
-     else chartType=2;
-
-     var chartDisplayOptionList = document.getElementById("chartDisplayOption");
-     var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
-   
-     if(indexForChart < 0) indexForChart=chartNamesToView[chartType].length-1;
-     iframeForChart.location.href = "generateChart.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;     
-   }   
-   
+
+// Chart Display Option change for sorting
+
    function chartDisplayOptionChange(evt)
    {
-     
-     var chartType = 0;
-     var tempICount = $selectedServiceList.size();
-     if(tempICount==0)  chartType=0;
-     else if(tempICount==1) chartType=1;
-     else chartType=2;
 
+     var chartTypeOptionList = document.getElementById("chartTypeOption");
+     var chartTypeOptionValue = chartTypeOptionList.options[ chartTypeOptionList.selectedIndex ].value;   
+ 
      var chartDisplayOptionList = document.getElementById("chartDisplayOption");
      var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
- 
-     iframeForChart.location.href = "generateChart.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;
-
+  
+   //  iframeForChart.location.href = "generateChart1.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;
+     
+     iframeForChart.location.href = "generateChart1.action?currentChart="+chartTypeOptionValue+"&chartDisplayOption="+chartDisplayOptionValue;
+       
      getSortedList(chartDisplayOptionValue);     
    }
 
@@ -113,383 +88,117 @@
 //fucction for selected Button is ViewChart
 
 function exportToExcelFunction1( summaryOption )
-{
-    var chartDisplayOptionList = document.getElementById("chartDisplayOption");
-    var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
-    
-    document.getElementById("exportExcelAnchor1").href="exportToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+	{
+	    //alert("inside Viw Summary:" + summaryOption );
+	    var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+	    var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+	    
+	    document.getElementById("exportExcelAnchor1").href="exportDataElementsToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+	
+	}
+ 
+function exportDataStatusResultToWorkBook()
+	{               
+	    document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;                                
+	
+	    return true;                
+	}
 
-}
- 
-                function exportDataStatusResultToWorkBook()
-            {               
-                document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;                                
-            
-                return true;                
-            }
-    
 //fucction for selected Button is ViewSummary
 
 function exportToExcelFunction2( summaryOption )
-{
-    var chartDisplayOptionList = document.getElementById("chartDisplayOption");
-    var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
-    
-    document.getElementById("exportExcelAnchor2").href="exportToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
-
-}
-
-
-
-
-
-</script>
-
-<script>
-
-
-// -----------------------------------------------------------------------------
-// Author:   Torgeir Lorange Ostby, torgeilo@xxxxxxxxx
-// Version:  $Id: request.js 2644 2007-01-03 13:24:56Z torgeilo $
-// -----------------------------------------------------------------------------
-
-/*
- * Usage:
- *
- * function processResponse( response ) { ... }             // Text or XML
- * function requestFailed( httpStatusCode ) { ... }
- *
- * var request = new Request();
- * request.setResponseTypeXML( 'rootElement' );             // Optional
- * request.sendAsPost( 'value=1&value=2' );                 // Optional
- * request.setCallbackSuccess( processResponse );           // Optional
- * request.setCallbackError( requestFailed );               // Optional
- * request.send( 'url.action?value=1' );
- */
-
-function Request()
-{
-    var request;
-    var responseType = 'TEXT';
-    var requestMethod = 'GET';
-    var requestParameters = null;
-    var rootElementName;
-    var callbackSuccess;
-    var callbackError;
-
-    this.setResponseTypeXML = function( rootElementName_ )
-    {
-        responseType = 'XML';
-        rootElementName = rootElementName_;
-    };
-    
-    this.sendAsPost = function( requestParameters_ )
-    {
-        requestMethod = 'POST';
-        requestParameters = requestParameters_;
-    };
-
-    this.setCallbackSuccess = function( callbackSuccess_ )
-    {
-        callbackSuccess = callbackSuccess_;
-    };
-    
-    this.setCallbackError = function( callbackError_ )
-    {
-        callbackError = callbackError_;
-    };
-
-    this.send = function( url )
-    {
-        request = newXMLHttpRequest();
-
-        if ( !request )
-        {
-            window.alert( "Your browser doesn't support XMLHttpRequest" );
-            return;
-        }
-
-        request.onreadystatechange = responseReceived;
-        request.open( requestMethod, url, true );
-        request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );         
-        request.send( requestParameters );
-    };
-    
-    function newXMLHttpRequest()
-    {
-        if ( window.XMLHttpRequest )
-        {
-            try
-            {
-                return new XMLHttpRequest();
-            }
-            catch ( e )
-            {
-                return false;
-            }
-        }
-        else if ( window.ActiveXObject )
-        {
-            try
-            {
-                return new ActiveXObject( 'Msxml2.XMLHTTP' );
-            }
-            catch ( e )
-            {
-                try
-                {
-                    return new ActiveXObject( 'Microsoft.XMLHTTP' );
-                }
-                catch ( ee )
-                {
-                    return false;
-                }
-            }
-        }
-        
-        return false;
-    }
-
-    function responseReceived()
-    {
-        if ( request.readyState == 4 )
-        {
-            switch( request.status )
-            {
-            case 200:
-                if ( callbackSuccess )
-                {
-                    if ( responseType == 'TEXT' )
-                    {
-                        callbackSuccess( request.responseText );
-                    }
-                    else
-                    {
-                        var xml = textToXML( request.responseText, rootElementName );
-
-                        callbackSuccess( xml );
-                    }
-                }
-                break;
-            case 204:
-                if ( callbackSuccess )
-                {
-                    callbackSuccess( null );
-                }
-                break;
-            case 500:
-                var message = 'Operation failed - internal server error';
-                
-                var serverMessage = request.responseText;
-
-                if ( serverMessage )
-                {
-                    var maxLength = 512;
-                    
-                    if ( serverMessage.length > maxLength )
-                    {
-                        serverMessage = serverMessage.substring( 0, maxLength - 3 ) + '...';
-                    }
-                    
-                    if ( serverMessage.length > 0 )
-                    {
-                        message += '\n\n' + serverMessage;
-                    }
-                }
-
-                message += '\n\nThe error details are logged';
-
-                window.alert( message );
-
-                break;
-            default:
-                if ( callbackError )
-                {
-                    callbackError( request.status );
-                }
-            }
-        }
-    }
-
-    function textToXML( text, rootElementName )
-    {
-        var docImpl = document.implementation;
-        var parser, dom;
-
-        // For standards compliant browsers
-        if ( docImpl && docImpl.createLSParser )
-        {
-            parser = docImpl.createLSParser( docImpl.MODE_SYNCHRONOUS, null );
-            var input = docImpl.createLSInput();
-            input.stringData = text;
-            return parser.parse( input ).documentElement;
-        }
-
-        // For IE
-        else if ( window.ActiveXObject )
-        {
-            dom = new ActiveXObject( 'Microsoft.XMLDOM' );
-            dom.async = "false";
-            dom.loadXML( text );
-            return dom.getElementsByTagName( rootElementName )[0];
-        }
-
-        // For Mozilla
-        else if ( window.DOMParser )
-        {
-            parser = new DOMParser();
-            dom = parser.parseFromString( text, 'application\/xml' );
-            return dom.documentElement;
-        }
-
-        // No parsing abilities
-        return null;
-    }
-}
-
-
-
-
-</script>
-
-</head>
-<body >
-    <div align="right">
-        
-        #if($selectedButton.equals("ViewSummary"))
-                   <!--     <a href="exportToExcel.action?viewSummary=yes" target="_blank">Export To WorkBook</a> -->
-                   <a id="exportExcelAnchor2" name="exportExcelAnchor2" href="#" onclick="javascript:exportToExcelFunction2('yes')" target="_blank">Export To WorkBook</a>
-                                                &nbsp;&nbsp;
-                        <select id="chartDisplayOption" name="chartDisplayOption" onchange="getSortedListForSummary()">
-                            <option value="none">Select Sort Type</option>
-                            <option value="ascend">Ascending</option>
-                            <option value="desend">Desending</option>
-                            <option value="alphabet">Alphabetical</option>
-                        </select>
-                        &nbsp;&nbsp;
-                        
-                              <br><br>
-                        
-                    #else
-                        <a id="exportExcelAnchor1" name="exportExcelAnchor1" href="#" onclick="javascript:exportToExcelFunction1('no')" target="_blank">Export To Excel</a>
-                        &nbsp;&nbsp;
-                        <select id="chartDisplayOption" name="chartDisplayOption" onchange="chartDisplayOptionChange(event)">
-                            <option value="none">Select Sort Type</option>
-                            <option value="ascend">Ascending</option>
-                            <option value="desend">Desending</option>
-                            <option value="alphabet">Alphabetical</option>
-                        </select>
-                        &nbsp;&nbsp;
-                        <input type="button" name="prevChartButton" id="prevChartButton" style="width: 40; height: 35; background-image: url('images/moveLeft.gif'); background-repeat: no-repeat; background-position: center; " onClick="prevCharttoView()" title="Previous">
-                        <input type="button" name="nextChartButton" id="nextChartButton" style="width: 40; height: 35; background-image: url('images/moveRight.gif'); background-repeat: no-repeat; background-position: center;" onClick="nextCharttoView()" title="Next">             
-                        <br>
-                    #end          
-    </div> 
-    <br>
-    <form id="form1" name="form1" action="exportDataStatusToExcel.action" method="post" onsubmit="return exportDataStatusResultToWorkBook()" target="_newtab">
-                    <input type="hidden" name="htmlCode" id="htmlCode" />
-            <div align="right" class="NormalB">
-                <!--<input type="submit" name="ExportToWorkBook" value="Export To WorkBook" style="width: 160; height: 25; font-family:Arial; font-weight:bold; color:#000000">-->
-            </div>                  
- <div id="formResult">
-    #if($riRadio.equals("indicatorsRadio1") && $categoryLB.equals( "period" )) 
-    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">                
-        <tr>
-            <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1" rowspan="2">Service Name</td>              
-                #foreach($xaxisvalue in $xseriesList)
-                    <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" colspan="3">$xaxisvalue</td>                     
-                #end
-            </tr>
-            <tr>    
-                #foreach($xaxisvalue in $xseriesList)
-                    <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Num</td>
-                    <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Den</td>
-                    <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Val</td>                                        
-                #end                
-            </tr>
-            #set($count1 = 0)                           
-        #foreach($onedataList in $dataList)
-            #set($oneNumList = $numList.get($count1))
-            #set($oneDenList = $denList.get($count1))                    
-            <tr>
-                <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>
-                    #set($count2 = 0)
-                     #foreach($data in $onedataList)                        
-                         <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$oneNumList.get($count2)</td>
-                         <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$oneDenList.get($count2)</td>
-                         <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
-                         #set($count2 = $count2 + 1)                                 
-                     #end
-                     #set($count1 = $count1 + 1)
-            </tr>    
-        #end    
-    </table>
-    
-    #else    
-    <div id="headingInfoId">
-    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">                
-        <tr>
-            <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">Service Name</td>
-            #foreach($xaxisvalue in $xseriesList)
-              <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1">$xaxisvalue</td>                   
-            #end
-        </tr>
-        
-        #set($count1 = 0)
-        #set( $count3 = 0 )                             
-        #foreach($onedataList in $dataList)                    
-          <tr>
-            <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>
-                
-            #foreach($data in $onedataList)
-                #if( $categoryLB.equals( "period" ) && !$ougSetCB && $riRadio.equals( "dataElementsRadio" ) && $selectedStatus.get($count3).equals("yes") )
-                    <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownResult( event, '$selectedValues.get($count3)' )" target="_blank">$data</a></td>                                    
-                    #set( $count3 = $count3 + 1 )
-                #else
-                    <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
-                #end
-            #end
-            #set( $count1 = $count1 + 1 )
-          </tr>    
-        #end    
-    </table>
-    </div>
-    #end
-   
-    #if($selectedButton.equals("ViewSummary"))
-         <br><br>
+	{
+	   // alert("inside Viw Summary" + summaryOption );
+	    var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+	    var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+	    
+	    document.getElementById("exportExcelAnchor2").href="exportDataElementsToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+	
+	}
+
+</script>
+<div align="right" class="NormalB">
+    <table>
+        <tr>
+			<td class="NormalB">
+			   #if($selectedButton.equals("ViewSummary"))
+			          
+			  <td class="NormalB"><a id="exportExcelAnchor2" name="exportExcelAnchor2" href="#" onclick="javascript:exportToExcelFunction2('yes')" target="_blank">Export To WorkBook</a></td>
+			  <td class="NormalB">&nbsp;&nbsp;
+			            <select id="chartDisplayOption" name="chartDisplayOption" onchange="getSortedListForSummary()">
+			                <option value="none">Select Sort Type</option>
+			                <option value="ascend">Ascending</option>
+			                <option value="desend">Desending</option>
+			                <option value="alphabet">Alphabetical</option>
+			            </select>
+			            &nbsp;&nbsp;
+			  <br><br>
+			 </td>
+     </tr>      
+     #else    
+     <tr>        
+		<td class="NormalB"><a id="exportExcelAnchor1" name="exportExcelAnchor1" href="#" onclick="javascript:exportToExcelFunction1('no')" target="_blank">Export To Excel</a></td>
+		<td class="NormalB">&nbsp;&nbsp;<!--<font face="Arial, Helvetica, sans-serif" color="#000000">-->
+		            <select id="chartTypeOption" name="chartTypeOption" onchange="chartTypeOptionChange(event)">
+		                <option value="Vertical3DBarChart">Vertical 3D BarChart</option>
+		                <option value="Horizontal3DBarChart">Horizontal 3D BarChart</option>
+		                <option value="LineChart">Line Chart</option>
+		                <option value="LineAndBarChart">Line And BarChart</option>
+		                 <option value="AreaChart" >Area Chart</option>
+		            </select>
+		            &nbsp;&nbsp;
+		            <select id="chartDisplayOption" name="chartDisplayOption" onchange="chartDisplayOptionChange(event)">
+		                <option value="none">Select Sort Type</option>
+		                <option value="ascend">Ascending</option>
+		                <option value="desend">Desending</option>
+		                <option value="alphabet">Alphabetical</option>
+		            </select>
+		</td>        
+    </tr>            
+   #end 
+</table>             
+</div> 
+<div id="formResult">
+	<div id="headingInfoId">
+		<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">                
+		    <tr>
+		        <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">Data Element Name</td>
+		        #foreach($xaxisvalue in $dataElementChartResult.categories)
+		          <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1">$xaxisvalue</td>                   
+		        #end
+		    </tr>      
+			    #set($count1 = 0)
+			    #set( $count3 = 0 )                      
+			    #foreach($onedataList in $dataElementChartResult.data)  
+			    <!--	#set( $dataElementList = $dataElementChartResult.series )-->
+			     <!--    #set( $dataElementList = $dataElementChartResult.getSeries() )-->
+		      <tr>
+		        <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>
+		          <!--  <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$dataElementChartResult.series[$count1]</td>-->
+		           #foreach($data in $onedataList)
+		          <!--  #if( $categoryLB.equals( "period" ) && !$ougSetCB && $riRadio.equals( "dataElementsRadio" ) && $selectedStatus.get($count3).equals("yes") )
+		                <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownResult( event, '$selectedValues.get($count3)' )" target="_blank">$data</a></td>                                    
+		                #set( $count3 = $count3 + 1 )
+		            #else-->
+		                <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
+		            #end
+		        #end
+		        #set( $count1 = $count1 + 1 )
+		      </tr>    
+		    #end    
+		</table>
+	</div>
+#if($selectedButton.equals("ViewSummary"))
+    <br><br>
      #else
-         <br>
+     <br>
          <div align="center">
-             <iframe name="iframeForChart" id="iframeForChart" src="generateChart.action?currentChart=Vertical3DBarChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
+             <iframe name="iframeForChart" id="iframeForChart" src="generateChart1.action?currentChart=Vertical3DBarChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
          </div>    
          <br>
      #end
 </div> 
-     #if($riRadio.equals("indicatorsRadio"))
-         <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">
-                                <tr>
-                                        <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Indicator Names</font></td>
-                                        <td class="TableHeadingCellStyles" width="30%" colspan="2" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Formula</font></td>
-                                        <!-- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Numerator DataElements</font></td>
-                                        <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Denominator DataElements</font></td> -->                    
-                                </tr>
-                                #set($count1 = 0)
-                                #foreach($service in $selectedServiceList)
-                                    <tr>
-                                                <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$service.getName()</td>
-                                                <td class="TableHeadingCellStyles" width="25%" align="center" style="border-left-style:dotted; border-left-width:1; border-right-width:0; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><u>$service.getNumeratorDescription()</u><br>$service.getDenominatorDescription()</td>
-                                                <td class="TableHeadingCellStyles" width="5%" align="left" style="border-left-style:dotted; border-left-width:0; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">&nbsp;X&nbsp;$service.getIndicatorType().getFactor()</td>
-                                                <!-- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$numeratorDEList.get($count1)</td>
-                                                <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$denominatorDEList.get($count1)</td> -->
-                                        </tr>                                               
-                                    #set($count1 = $count1 + 1)
-                                #end
-                            </table>   
-     #end
-                        
-                <textarea id="testId" rows="10" cols="70" style="display:none">&nbsp;</textarea>                                                                        
-                </form>
+        <textarea id="testId" rows="10" cols="70" style="display:none">&nbsp;</textarea>                                                                        
+</form>
 
- </body>
- </html>   
\ No newline at end of file
+    
\ No newline at end of file

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js	2010-11-02 11:35:05 +0000
@@ -2,7 +2,7 @@
 function getOUDeatilsForGADataElements(orgUnitIds)
 {
 	document.getElementById( "ougGroupSetCB" ).disabled = false;
-	document.getElementById( "orgUnitGroup" ).disabled = false;
+	document.getElementById( "orgUnitGroupList" ).disabled = false;
 	$.post("getOrgUnitDetails.action",
 		{
 			orgUnitId:orgUnitIds
@@ -115,14 +115,14 @@
 function getOrgUnitGroupsDataElements() 
 {
 	var checked = byId('ougGroupSetCB').checked;
-	clearListById('orgUnitGroup');
+	clearListById('orgUnitGroupList');
 	clearListById('orgUnitListCB');
 	
 	document.ChartGenerationForm.orgUnitListCB.options[0] = new Option(currentOrgUnitName,currentOrgUnitId,false,false);
 
 	if (checked)
 	{
-		var ouGroupId = document.getElementById("orgUnitGroup");
+		var ouGroupId = document.getElementById("orgUnitGroupList");
 
 		for ( var i = 0; i < orgUnitGroupIds.length; i++) 
 		{
@@ -178,7 +178,7 @@
 	var categoryObj = document.getElementById( 'categoryLB' );// view by
     var categoryVal = categoryObj.options[ categoryObj.selectedIndex ].value;
 	
-    var orgGroupObj = document.getElementById( 'orgUnitGroup' ); // org unit group
+    var orgGroupObj = document.getElementById( 'orgUnitGroupList' ); // org unit group
     var orgGroupVal = orgGroupObj.options[ orgGroupObj.selectedIndex ].value;
     
 //    var categoryObj = document.getElementById( 'categoryLB' );
@@ -186,7 +186,7 @@
 	
     if( document.getElementById( 'ougGroupSetCB' ).checked &&  categoryVal == "period"  )
     {
-        var orgUnitGroupListObj = document.getElementById('orgUnitGroup');
+        var orgUnitGroupListObj = document.getElementById('orgUnitGroupList');
 	
         for( var i = 0; i < orgUnitGroupListObj.length; i++ )
         {
@@ -219,11 +219,20 @@
     }
 }
 */
+
+// Selected Button (ie ViewSummary or ViewChart) Function
+function selButtonFunction1(selButton)
+{
+	document.ChartGenerationForm.selectedButton.value = selButton;
+}
+ // selButtonFunction end
+
+
 //Graphical Analysis Form Validations
 function formValidationsDataElement()
 {
 		
-	var selectedServices = document.getElementById("selectedServices");
+	//var selectedServices = document.getElementById("selectedServices");
 
 	var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;//alert(selOUListLength);
 	var selDEListSize  = document.ChartGenerationForm.selectedDataElements.options.length;//alert(selDEListSize);
@@ -231,9 +240,9 @@
 	var orgUnitListCB = document.getElementById("orgUnitListCB");
 	var selectedDataElements = document.getElementById("selectedDataElements");
 	
-	var orgUnitGroupCB = document.getElementById("orgUnitGroup");
+	var orgUnitGroupCB = document.getElementById("orgUnitGroupList");
 	
-	var selOUGroupListLength = document.ChartGenerationForm.orgUnitGroup.options.length;
+	var selOUGroupListLength = document.ChartGenerationForm.orgUnitGroupList.options.length;
 	
 	var selyearLB = document.getElementById("yearLB");
     var selperiodLB = document.getElementById("periodLB");
@@ -243,7 +252,7 @@
 	
     var k = 0;
 
-    if(  selectedDataElements.selectedIndex < 0 ) 
+    if(  selDEListSize <= 0 ) 
 		{
 	        alert( "Please Select DataElement(s)" );
 	        return false;
@@ -255,22 +264,16 @@
 	        return false;
 		}
    
-    else if(document.getElementById( 'ougGroupSetCB' ).checked ) 
+    else if(document.getElementById( 'ougGroupSetCB' ).checked && orgUnitGroupCB.selectedIndex < 0 ) 
     	{
-	    	if( orgUnitGroupCB.selectedIndex < 0 ) 
+    		alert( "Please select OrgUnitGroup" );
+    		return false;
+    	/*if( orgUnitGroupCB.selectedIndex < 0 ) 
 	    	{
 	            alert( "Please select OrgUnitGroup" );
-	            return false;
-	        }
-	    	else
-	        {
-	        	for( k=0;k<selOUListLength;k++ )
-	        	{
-	        		document.ChartGenerationForm.orgUnitListCB.options[k].selected = true;
-	        	}
-	        }
+	            
+	        }*/
     	}	
-  
     else if( periodTypeId == yearlyPeriodTypeName )
 	   {
 	       if( selyearLB.selectedIndex < 0 ) 
@@ -309,8 +312,8 @@
         }
     }
   
-    var sWidth = 850;
-	var sHeight = 650;
+    var sWidth = 1000;
+	var sHeight = 1000;
     var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
     var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
 

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm	2010-11-02 11:35:05 +0000
@@ -1,6 +1,6 @@
 
 
-<h2>$i18n.getString( "dashboard" )DashBoard</h2>
+<h2>$i18n.getString( "dashboard" )</h2>
     <ul>
         <li>$i18n.getString( "graphical_analysis" )</li>
         <ul>