dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08681
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2138: Added Indicator Wise Graphical Analysis in Dashboard
------------------------------------------------------------
revno: 2138
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-11-22 18:32:23 +0530
message:
Added Indicator Wise Graphical Analysis in Dashboard
added:
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportIndicatorToExcelAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataElementAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedIndicatorDataAction.java
modified:
local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
local/in/dhis-web-dashboard/pom.xml
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/GetSortedDataAction.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/ga/action/charts/GenerateChartDataElementAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.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/util/DashBoardService.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java
local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
local/in/dhis-web-dashboard/src/main/resources/struts.xml
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2010-11-09 15:02:39 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2010-11-22 13:02:23 +0000
@@ -1201,8 +1201,9 @@
}
public String getIndividualResultIndicatorValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit )
{
- int deFlag1 = 0;
- int deFlag2 = 0;
+
+ int deFlag1 = 0;
+ int deFlag2 = 0;
try
{
Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
@@ -1232,10 +1233,10 @@
String numeratorExp = indicator.getNumerator();
String denominatorExp = indicator.getDenominator();
int indicatorFactor = indicator.getIndicatorType().getFactor();
- String reportModelTB = null;
- String numeratorVal = getIndividualResultDataValue( numeratorExp, startDate, endDate, organisationUnit, reportModelTB );
+ String reportModelTB = "";
+ String numeratorVal = getIndividualResultDataValue( numeratorExp, startDate, endDate, organisationUnit, reportModelTB );
String denominatorVal = getIndividualResultDataValue( denominatorExp, startDate, endDate, organisationUnit, reportModelTB );
-
+
double numeratorValue;
try
{
@@ -1302,11 +1303,15 @@
deFlag2 = 0;
resultValue = buffer.toString();
}
+
return resultValue;
- } catch ( NumberFormatException ex )
+
+ }
+ catch ( NumberFormatException ex )
{
throw new RuntimeException( "Illegal DataElement id", ex );
}
+
}
// -------------------------------------------------------------------------
=== modified file 'local/in/dhis-web-dashboard/pom.xml'
--- local/in/dhis-web-dashboard/pom.xml 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/pom.xml 2010-11-22 13:02:23 +0000
@@ -35,12 +35,12 @@
<version>${version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-service-linelisting</artifactId>
<version>${version}</version>
</dependency>
-<dependency>
+ <dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-service-dbmanager</artifactId>
<version>${version}</version>
=== modified 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 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportDataElementToExcelAction.java 2010-11-22 13:02:23 +0000
@@ -256,7 +256,7 @@
}
else
{
- sheet0.addCell( new Label( tempCol1, tempRow1, "Service", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1, tempRow1, "DataElements", wCellformat2) );
}
tempCol1++;
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportIndicatorToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportIndicatorToExcelAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportIndicatorToExcelAction.java 2010-11-22 13:02:23 +0000
@@ -0,0 +1,566 @@
+/*
+ * 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.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
+import jxl.write.Label;
+import jxl.write.Number;
+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 ExportIndicatorToExcelAction.java Nov 18, 2010 4:24:16 PM
+ */
+public class ExportIndicatorToExcelAction 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[][] numDataArray;
+
+ double[][] denumDataArray;
+
+ String[] series1;
+
+ // String[] denumDataArray;
+
+ 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;
+ int tempCol2 = 0;
+
+ 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[][] objnumData1 = (Double[][]) session.getAttribute( "numDataArray" );
+ Double[][] objdenumData1 = (Double[][]) session.getAttribute( "denumDataArray" );
+ //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 || objnumData1 == null || objdenumData1 == null )
+ System.out.println("Session Objects are null");
+ else
+ System.out.println("Session Objects are not null");
+
+ data1 = convertDoubleTodouble( objData1 );
+
+ numDataArray = convertDoubleTodouble( objnumData1 );
+ denumDataArray = convertDoubleTodouble( objdenumData1 );
+
+ // 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( "IndicatorChartOutput", 0 );
+
+ if(viewSummary.equals( "no" ))
+ {
+ WritableImage writableImage = new WritableImage(0,1,10,23,encoderBytes);
+ sheet0.addImage( writableImage );
+ tempRow1 = 24;
+ }
+ else
+ {
+ // tempRow1 -= objData1.length;
+ tempRow1 = 0;
+ }
+
+ tempCol1 = 0;
+ tempCol2 = 0;
+ tempRow1++;
+ WritableCellFormat wCellformat1 = new WritableCellFormat();
+ wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat1.setAlignment( Alignment.CENTRE );
+ wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat1.setWrap( true );
+
+ WritableCellFormat wCellformat2 = new WritableCellFormat();
+ wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat2.setAlignment( Alignment.CENTRE );
+ wCellformat2.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat2.setBackground( Colour.GRAY_25 );
+ wCellformat2.setWrap( true );
+
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
+
+ tempCol1++;
+ tempCol2++;
+ // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
+ for(int i=0; i< categories1.length; i++)
+ {
+ //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ // cellFormat1 = cell1.getCellFormat();
+
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 2, tempRow1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
+
+ // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1+1, "Num", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1+1, "Den", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+2, tempRow1+1, "Val", wCellformat2) );
+
+ tempCol1 = tempCol1+3;
+ //tempCol2++;
+ }
+ tempRow1 = tempRow1+2;
+ // tempCol1 = 1;
+
+ tempCol1 = 0;
+ for(int j=0; j< series1.length; j++)
+ {
+ tempCol1 = 0;
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+
+ tempCol1++;
+ for( int k=0;k<categories1.length;k++ )
+ {
+
+ //sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ sheet0.addCell( new Number( tempCol1, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ sheet0.addCell( new Number( tempCol1+1, tempRow1, denumDataArray[j][k], wCellformat1 ) );
+ sheet0.addCell( new Number( tempCol1+2, tempRow1, data1[j][k], wCellformat1 ) );
+
+ tempCol1 = tempCol1+3;
+ }
+
+ tempRow1++;
+ }
+
+ // tempCol1++;
+
+ //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ //cellFormat1 = cell1.getCellFormat();
+
+ // sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
+ //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
+
+ // tempCol1++;
+
+
+
+
+
+/*
+ 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, "Indicators", 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 = "Indicator 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 < categories1S.length; i++)
+ {
+ categories1[i] = categories1S[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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[j+1] = temp2;
+ }
+ }
+ }
+
+ }
+}// class end
=== 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-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataAction.java 2010-11-22 13:02:23 +0000
@@ -12,7 +12,7 @@
import com.opensymphony.xwork2.ActionContext;
public class GetSortedDataAction
-implements Action
+ implements Action
{
double[][] data1;
@@ -26,127 +26,139 @@
String[] categories2;
- private List<String> headingInfo;
+ private List<String> headingInfo;
public List<String> getHeadingInfo()
{
return headingInfo;
}
-
public String execute()
throws Exception
{
headingInfo = new ArrayList<String>();
-
+
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
String chartDisplayOption = req.getParameter( "chartDisplayOption" );
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" );
-
-
- // 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");
+ String[] categories2S = (String[]) session.getAttribute( "categories2" );
+
+ initialzeAllLists( series1S, series2S, categories1S, categories2S );
+
+ if ( objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null
+ || categories2 == null )
+ System.out.println( "Session Objects are null" );
else
- System.out.println("Session Objects are not null");
-
+ 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(); }
-
+ 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(headingInfo);
-
+
+ // System.out.println(headingInfo);
+
return SUCCESS;
}// execute end
-
public void initializeDataLists()
{
int i;
- headingInfo.add( "<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
+ .add( "<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.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+categories1[i]+"</td>" );
+ headingInfo
+ .add( "<td class=\"TableHeadingCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"
+ + categories1[i] + "</td>" );
}
headingInfo.add( "</tr>" );
-
- for(i=0; i<data1.length; i++)
+
+ for ( i = 0; i < data1.length; i++ )
{
- headingInfo.add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"+series1[i]+"</td>" );
- for(int j=0; j<data1[i].length; j++)
+ headingInfo
+ .add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"
+ + series1[i] + "</td>" );
+ for ( int j = 0; j < data1[i].length; j++ )
{
- headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+data1[i][j]+"</td>" );
+ headingInfo
+ .add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"
+ + data1[i][j] + "</td>" );
}
headingInfo.add( "</tr>" );
}
-
+
headingInfo.add( "</table>" );
}
-
-// public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
- public void initialzeAllLists(String[]series1S, String[] categories1S )
+
+ public void initialzeAllLists( String[] series1S, String[] series2S, String[] categories1S, String[] categories2S )
{
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];
-
- 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];
- }
-*/
+ 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 : ");
+ // System.out.println("Before Sorting : ");
double[][] data = new double[series1.length][categories1.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.print(categories1[j]+": "+data[i][j]+", ");
}
- //System.out.println("");
+ // System.out.println("");
}
return data;
@@ -154,134 +166,134 @@
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;
- }
- }
- }
-*/
- }
+ 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;
- }
- }
- }
-*/
- }
-
+ 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;
- }
- }
- }
-*/
+ {
+ 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
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataElementAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataElementAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedDataElementAction.java 2010-11-22 13:02:23 +0000
@@ -0,0 +1,256 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.struts2.ServletActionContext;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GetSortedDataElementAction.java Nov 22, 2010 10:37:45 AM
+ */
+public class GetSortedDataElementAction
+ implements Action
+{
+ double[][] data1;
+
+ String[] series1;
+
+ String[] categories1;
+
+ private List<String> headingInfo;
+
+ public List<String> getHeadingInfo()
+ {
+ return headingInfo;
+ }
+
+ public String execute()
+ throws Exception
+ {
+
+ headingInfo = new ArrayList<String>();
+
+ ActionContext ctx = ActionContext.getContext();
+ HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+ String chartDisplayOption = req.getParameter( "chartDisplayOption" );
+
+ HttpSession session = req.getSession();
+ Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
+
+ String[] series1S = (String[]) session.getAttribute( "series1" );
+
+ String[] categories1S = (String[]) session.getAttribute( "categories1" );
+
+ // 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 );
+
+ 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(headingInfo);
+
+ return SUCCESS;
+ }// execute end
+
+ public void initializeDataLists()
+ {
+ int i;
+ headingInfo
+ .add( "<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
+ .add( "<td class=\"TableHeadingCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"
+ + categories1[i] + "</td>" );
+ }
+ headingInfo.add( "</tr>" );
+
+ for ( i = 0; i < data1.length; i++ )
+ {
+ headingInfo
+ .add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"
+ + series1[i] + "</td>" );
+ for ( int j = 0; j < data1[i].length; j++ )
+ {
+ headingInfo
+ .add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"
+ + data1[i][j] + "</td>" );
+ }
+ headingInfo.add( "</tr>" );
+ }
+
+ headingInfo.add( "</table>" );
+ }
+
+ // 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 < categories1S.length; i++ )
+ {
+ categories1[i] = categories1S[i];
+ }
+
+ }
+
+ public double[][] convertDoubleTodouble( Double[][] objData )
+ {
+ // System.out.println("Before Sorting : ");
+ double[][] data = new double[series1.length][categories1.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;
+ }
+ }
+ }
+
+ }
+
+ 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;
+ }
+ }
+ }
+
+ }
+
+ 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;
+ }
+ }
+ }
+
+ }
+
+}// class end
+
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedIndicatorDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedIndicatorDataAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetSortedIndicatorDataAction.java 2010-11-22 13:02:23 +0000
@@ -0,0 +1,311 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.struts2.ServletActionContext;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GetSortedIndicatorDataAction.java Nov 18, 2010 11:13:44 AM
+ */
+public class GetSortedIndicatorDataAction implements Action
+{
+ double[][] data1;
+
+ double[][] numDataArray;
+
+ double[][] denumDataArray;
+
+ String[] series1;
+
+ String[] categories1;
+
+ private List<String> headingInfo;
+
+ public List<String> getHeadingInfo()
+ {
+ return headingInfo;
+ }
+
+ public String execute() throws Exception
+ {
+ headingInfo = new ArrayList<String>();
+
+ System.out.println( "Inside Sorting action Class name GetSortedIndicatorDataAction" );
+ ActionContext ctx = ActionContext.getContext();
+ HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+ String chartDisplayOption = req.getParameter( "chartDisplayOption" );
+
+ HttpSession session = req.getSession();
+ Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
+ Double[][] objnumData1 = (Double[][]) session.getAttribute( "numDataArray" );
+ Double[][] objdenumData1 = (Double[][]) session.getAttribute( "denumDataArray" );
+ // 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 || objnumData1 == null || objdenumData1 == null )
+ System.out.println("Session Objects are null");
+ else
+ System.out.println("Session Objects are not null");
+
+ data1 = convertDoubleTodouble( objData1 );
+ numDataArray = convertDoubleTodouble( objnumData1 );
+ denumDataArray = convertDoubleTodouble( objdenumData1 );
+ // 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(headingInfo);
+
+
+
+ return SUCCESS;
+ }// execute end
+
+
+ public void initializeDataLists()
+ {
+ int i;
+ headingInfo.add( "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-style: solid\" bordercolor=\"#111111\" width=\"100%\"><tr><td class=\"TableHeadingCellStyles\" bgcolor=\"#C0C0C0\" rowspan=2 style=\"border-style: dotted; border-width: 1\"><strong>Indicator Names</strong></td>" );
+
+ for(i=0; i < categories1.length; i++)
+ {
+ headingInfo.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" bgcolor=\"#C0C0C0\" colspan= 3 style=\"border-style: dotted; border-width: 1\"><strong>"+categories1[i]+"</strong></td>" );
+ }
+ headingInfo.add( "</tr>" );
+
+ for(i=0; i < categories1.length; i++)
+ {
+ //String numerator = "Num";
+ //String denumerator = "Den";
+ //String value = "Val";
+ //headingInfo.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\"></td>" );
+ headingInfo.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" bgcolor=\"#C0C0C0\" style=\"border-style: dotted; border-width: 1\"><strong>Num</strong></td>" );
+ headingInfo.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" bgcolor=\"#C0C0C0\" style=\"border-style: dotted; border-width: 1\"><strong>Den</strong></td>" );
+ headingInfo.add( "<td class=\"TableHeadingCellStyles\" align=\"center\" bgcolor=\"#C0C0C0\" style=\"border-style: dotted; border-width: 1\"><strong>Val</strong></td>" );
+ }
+ headingInfo.add( "</tr>" );
+ /*
+
+ for(i=0; i<numDataArray.length; i++)
+ {
+ headingInfo.add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"+series1[i]+"</td>" );
+ for(int j=0; j<numDataArray[i].length; j++)
+ {
+ headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+numDataArray[i][j]+"</td>" );
+ }
+ //headingInfo.add( "</tr>" );
+ }
+
+ for(i=0; i<denumDataArray.length; i++)
+ {
+ headingInfo.add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"+series1[i]+"</td>" );
+ for(int j=0; j<denumDataArray[i].length; j++)
+ {
+ headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+denumDataArray[i][j]+"</td>" );
+ }
+ // headingInfo.add( "</tr>" );
+ }
+*/
+ for(i=0; i<data1.length; i++)
+ {
+ headingInfo.add( "<tr><td class=\"TableHeadingCellStyles\" style=\"border-style: dotted; border-width: 1\">"+series1[i]+"</td>" );
+ for(int j=0; j<data1[i].length; j++)
+ {
+ headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+numDataArray[i][j]+"</td>" );
+ headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+denumDataArray[i][j]+"</td>" );
+ headingInfo.add( "<td class=\"TableDataCellStyles\" align=\"center\" style=\"border-style: dotted; border-width: 1\">"+data1[i][j]+"</td>" );
+
+ }
+ headingInfo.add( "</tr>" );
+ }
+
+ headingInfo.add( "</table>" );
+ }
+
+
+ public void initialzeAllLists(String[]series1S, String[] categories1S )
+ {
+ int i;
+ series1 = new String[series1S.length];
+ categories1 = new String[categories1S.length];
+
+ for(i = 0; i < series1S.length; i++)
+ {
+ series1[i] = series1S[i];
+ }
+
+ for(i = 0; i < categories1S.length; i++)
+ {
+ categories1[i] = categories1S[i];
+ }
+
+ }
+
+ public double[][] convertDoubleTodouble( Double[][] objData )
+ {
+ //System.out.println("Before Sorting : ");
+ double[][] data = new double[series1.length][categories1.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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[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;
+
+ temp1 = numDataArray[k][j];
+ numDataArray[k][j] = numDataArray[k][j+1];
+ numDataArray[k][j+1] = temp1;
+
+ temp1 = denumDataArray[k][j];
+ denumDataArray[k][j] = denumDataArray[k][j+1];
+ denumDataArray[k][j+1] = temp1;
+ }
+
+ String temp2 = categories1[j];
+ categories1[j] = categories1[j+1];
+ categories1[j+1] = temp2;
+ }
+ }
+ }
+
+ }
+
+}// class end
+
=== modified 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 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java 2010-11-22 13:02:23 +0000
@@ -151,14 +151,14 @@
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");
@@ -175,7 +175,7 @@
initializeDataLists();
- System.out.println( "current chart Type is : " + currentChart + "And Chart Display Option is : " + chartDisplayOption );
+ System.out.println( "current chart Type is : " + currentChart + " ,And Chart Display Option is : " + chartDisplayOption );
if ( currentChart == null )
{
@@ -316,7 +316,7 @@
{
// System.out.println(objData[i][j]);
data[i][j] = objData[i][j].doubleValue();
- // System.out.print(categories1[j]+": "+data[i][j]+", ");
+ System.out.print(categories1[j]+": "+data[i][j]+", ");
}
//System.out.println("");
}
=== 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-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java 2010-11-22 13:02:23 +0000
@@ -1216,25 +1216,27 @@
int orgGroupCount = 0;
// int orgGroupCount1 = 0;
- Double aggDataValue = 0.0;
+ // Double aggDataValue = 0.0;
for( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
{
// Double aggDataValue = 0.0;
+ Double aggDataValue = 0.0;
+
categories[orgGroupCount] = orgUnitGroup.getName();
if( serviceCount == 0 )
{
chartTitle += orgUnitGroup.getName() + ",";
}
- Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroup.getMembers();
+ Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroupMap.get( orgUnitGroup );
if( orgUnitGroupMembers == null || orgUnitGroupMembers.size() == 0 )
{
data[serviceCount][orgGroupCount] = aggDataValue;
orgGroupCount++;
continue;
}
- for( OrganisationUnit orgUnit : orgUnitGroup.getMembers() )
+ for( OrganisationUnit orgUnit : orgUnitGroupMembers )
{
int periodCount = 0;
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-11-22 13:02:23 +0000
@@ -25,19 +25,22 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.dashboard.ga.action.charts;
-
+
import java.text.SimpleDateFormat;
import java.util.ArrayList;
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.apache.velocity.tools.generic.ListTool;
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dashboard.util.DashBoardService;
import org.hisp.dhis.dashboard.util.IndicatorChartResult;
@@ -45,49 +48,45 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
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 org.hisp.dhis.reports.ReportService;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
/**
* @author Mithilesh Kumar Thakur
- *
+ *
* @version GenerateChartIdicatorAction.java Nov 3, 2010 12:41:31 PM
*/
public class GenerateChartIndicatorAction
-implements Action
+ implements Action
{
-private final String PERIODWISE = "period";
-
-private final String CHILDREN = "children";
-
-private final String SELECTED = "random";
-
-IndicatorChartResult indicatorChartResult = new IndicatorChartResult() ;
-
-
-// -------------------------------------------------------------------------
-// Dependencies
-// -------------------------------------------------------------------------
-
-
+ private final String PERIODWISE = "period";
+
+ private final String CHILDREN = "children";
+
+ private final String SELECTED = "random";
+
+ // IndicatorChartResult indicatorChartResult = new IndicatorChartResult() ;
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
private StatementManager statementManager;
-
-
+
public void setStatementManager( StatementManager statementManager )
{
this.statementManager = statementManager;
- }
+ }
private DashBoardService dashBoardService;
@@ -95,245 +94,292 @@
{
this.dashBoardService = dashBoardService;
}
-
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
+
private AggregationService aggregationService;
-
+
public void setAggregationService( AggregationService aggregationService )
{
this.aggregationService = aggregationService;
}
-
+
private IndicatorService indicatorService;
-
+
public void setIndicatorService( IndicatorService indicatorService )
{
this.indicatorService = indicatorService;
}
-
+
+ private ReportService reportService;
+
+ public void setReportService( ReportService reportService )
+ {
+ this.reportService = reportService;
+ }
+
private OrganisationUnitService organisationUnitService;
-
+
public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
{
this.organisationUnitService = organisationUnitService;
}
-
+
private OrganisationUnitGroupService organisationUnitGroupService;
public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
{
this.organisationUnitGroupService = organisationUnitGroupService;
}
-
+
private I18nFormat format;
-
+
public void setFormat( I18nFormat format )
{
this.format = format;
}
-
- // -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
- /*
- private Comparator<Indicator> indicatorComparator;
-
- public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
- {
- this.indicatorComparator = indicatorComparator;
- }
- */
- //--------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------
// Parameters
- //--------------------------------------------------------------------------
+ // --------------------------------------------------------------------------
private HttpSession session;
-
+
public HttpSession getSession()
{
return session;
}
-
-
+
private List<Object> selectedServiceList;
-
+
public List<Object> getSelectedServiceList()
{
return selectedServiceList;
}
-
+
private List<OrganisationUnit> selOUList;
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
-
+
private List<String> selectedIndicators;
-
+
public void setSelectedIndicators( List<String> selectedIndicators )
{
this.selectedIndicators = selectedIndicators;
}
-
-
-
+
private String ougGroupSetCB;
-
+
public void setOugGroupSetCB( String ougGroupSetCB )
{
this.ougGroupSetCB = ougGroupSetCB;
}
-
+
public String getOugGroupSetCB()
{
return ougGroupSetCB;
}
-
-
-
+
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 aggDataCB;
-
+
+ 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 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 IndicatorChartResult indicatorChartResult;
+
+ public IndicatorChartResult getIndicatorChartResult()
+ {
+ return indicatorChartResult;
+ }
+
+ List<Indicator> yseriesList;
+
+ public List<Indicator> getYseriesList()
+ {
+ return yseriesList;
+ }
+
+ List<String> numeratorDEList;
+
+ public List<String> getNumeratorDEList()
+ {
+ return numeratorDEList;
+ }
+
+ List<String> denominatorDEList;
+
+ public List<String> getDenominatorDEList()
+ {
+ return denominatorDEList;
+ }
+
+ ListTool listTool;
+
+ public ListTool getListTool()
+ {
+ return listTool;
+ }
+
+ private OrganisationUnit selectedOrgUnit;
+
+ private OrganisationUnitGroup selOrgUnitGroup;
+
+ private List<OrganisationUnit> selOUGroupMemberList = new ArrayList<OrganisationUnit>();
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
+
@SuppressWarnings( "unchecked" )
public String execute()
throws Exception
{
-
+
statementManager.initialise();
-
+
+ listTool = new ListTool();
+
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 : " + selectedIndicators );
-
- System.out.println( "selected dataelements size : " + selectedIndicators.size() );
-
+
+ // System.out.println( "selected Period size : " + periodLB.size() );
+
+ System.out.println( "selected Indicators : " + selectedIndicators );
+
+ System.out.println( "selected Indicators size : " + selectedIndicators.size() );
+ /*
+ * double d = 4.57767; System.out.println(Math.round(d));
+ */
+
// int flag = 0;
// selOUList = new ArrayList<OrganisationUnit>();
selStartPeriodList = new ArrayList<Date>();
selEndPeriodList = new ArrayList<Date>();
-
+
+ yseriesList = new ArrayList<Indicator>();
+
+ numeratorDEList = new ArrayList<String>();
+ denominatorDEList = new ArrayList<String>();
+
// 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);
@@ -344,7 +390,7 @@
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 ) ) );
@@ -395,166 +441,939 @@
selStartPeriodList.add( format.parseDate( startD ) );
selEndPeriodList.add( format.parseDate( endD ) );
}
-
+
System.out.println( startD + " : " + endD );
}
-
- }
-
- List<Indicator> indicatorList = new ArrayList<Indicator>();
- Iterator deIterator = selectedIndicators.iterator();
- while ( deIterator.hasNext() )
- {
- String indicatorId = (String) deIterator.next();
-
- Indicator indicator = indicatorService.getIndicator( indicatorId );
-
- indicatorList.add( indicator );
-
- }
-
- selectedServiceList = new ArrayList<Object>( indicatorList );
-
+
+ }
+ // Indicator Information
+ List<Indicator> indicatorList = new ArrayList<Indicator>();
+ Iterator deIterator = selectedIndicators.iterator();
+ while ( deIterator.hasNext() )
+ {
+ // String indicatorId = (String) deIterator.next();
+ int serviceID = Integer.parseInt( (String) deIterator.next() );
+ Indicator indicator = indicatorService.getIndicator( serviceID );
+
+ indicatorList.add( indicator );
+
+ }
+
+ selectedServiceList = new ArrayList<Object>( indicatorList );
+
// OrgUnit Information
-
+
for ( String ouStr : orgUnitListCB )
{
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( ouStr ) );
selOUList.add( orgUnit );
}
-
+
// calling individual Function
if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB == null )
{
-
- System.out.println( "Inside PeriodWise Chart Data" );
- System.out.println( "\n\nsize of OrgUnit List : " + selOUList.size()+ " , size of Indicator List : " + indicatorList.size() );
-
- indicatorChartResult = generateChartDataPeriodWise( selStartPeriodList,selEndPeriodList, periodNames, indicatorList, selOUList.iterator().next() );
-
-
-
+
+ System.out.println( "Inside PeriodWise Chart Data and group not selected" );
+ System.out.println( "\n\nsize of OrgUnit List : " + selOUList.size() + " , size of Indicator List : "
+ + indicatorList.size() );
+ System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+ indicatorChartResult = generateChartDataPeriodWise( selStartPeriodList, selEndPeriodList, periodNames,
+ indicatorList, selOUList.iterator().next() );
+
}
else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB == null )
{
- // System.out.println( "Report Generation Start Time is : \t" + new
- // Date() );
+
System.out.println( "Inside ChildWise Chart Data" );
- // generateChartDataWithChildWise();
-
+ 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() );
+
+ indicatorChartResult = generateChartDataWithChildrenWise( selStartPeriodList, selEndPeriodList,
+ periodNames, indicatorList, childOrgUnitList );
+
}
else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB == null )
{
- // System.out.println( "Report Generation Start Time is : \t" + new
- // Date() );
-
+
System.out.println( "Inside SelectedOrgUnit Chart Data" );
- // generateChartDataSelectedOrgUnitWise();
-
+ System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+
+ indicatorChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList, selEndPeriodList,
+ periodNames, indicatorList, selOUList );
+
}
-
+
else if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB != null )
{
- // System.out.println( "Report Generation Start Time is : \t" + new
- // Date() );
+
System.out.println( "Inside ChildWise With OrgGroup Chart Data" );
- // generateChartDataOrgGroupPeriodWise();
-
+ 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() ) );
+
+ // System.out.println( "oug Group Set is = " + orgUnitGroupList );
+
+ selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupList
+ .get( 0 ) ) );
+
+ selOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
+
+ selOUGroupMemberList.retainAll( orgUnitChildList );
+
+ indicatorChartResult = generateChartDataOrgGroupPeriodWise( selStartPeriodList, selEndPeriodList,
+ periodNames, indicatorList, selOUGroupMemberList );
+
}
-
+
else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB != null )
{
- // System.out.println( "Report Generation Start Time is : \t" + new
- // Date() );
+
System.out.println( "Inside ChildWise With OrgGroup Chart Data" );
- // generateChartDataOrgGroupChildWise();
-
+ 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 );
+
+ // groupCount++;
+
+ }
+
+ selOUGroupMemberList.retainAll( orgUnitChildList );
+
+ indicatorChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList, selEndPeriodList,
+ periodNames, indicatorList, selOUGroupMemberList );
+
}
-
+
else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB != null )
{
- // System.out.println( "Report Generation Start Time is : \t" + new
- // Date() );
-
+
System.out.println( "Inside SelectedOrgUnit With OrgGroup Chart Data" );
- // generateChartDataSelectedOrgUnitGroupWise();
-
- }
+ System.out.println( "Chart Generation Start Time is : \t" + new Date() );
+
+ Map<OrganisationUnitGroup, List<OrganisationUnit>> orgUnitGroupMap = new HashMap<OrganisationUnitGroup, List<OrganisationUnit>>();
+
+ 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 );
+ }
+
+ indicatorChartResult = generateChartDataSelectedOrgUnitGroupWise( selStartPeriodList, selEndPeriodList,
+ periodNames, indicatorList, orgUnitGroupMap );
+
+ }
+
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
session = req.getSession();
-
session.setAttribute( "data1", indicatorChartResult.getData() );
- session.setAttribute( "series1", indicatorChartResult.getSeries()) ;
- session.setAttribute( "categories1", indicatorChartResult.getCategories()) ;
- session.setAttribute( "chartTitle", indicatorChartResult.getChartTitle()) ;
- session.setAttribute( "xAxisTitle", indicatorChartResult.getXAxis_Title()) ;
- session.setAttribute( "yAxisTitle", indicatorChartResult.getYAxis_Title()) ;
-
+ session.setAttribute( "numDataArray", indicatorChartResult.getNumDataArray() );
+ session.setAttribute( "denumDataArray", indicatorChartResult.getDenumDataArray() );
+ session.setAttribute( "series1", indicatorChartResult.getSeries() );
+ session.setAttribute( "categories1", indicatorChartResult.getCategories() );
+ session.setAttribute( "chartTitle", indicatorChartResult.getChartTitle() );
+ session.setAttribute( "xAxisTitle", indicatorChartResult.getXAxis_Title() );
+ session.setAttribute( "yAxisTitle", indicatorChartResult.getYAxis_Title() );
+
statementManager.destroy();
+ System.out.println( "Chart Generation End Time is : \t" + new Date() );
return SUCCESS;
-
- // execute end
- }
-
-
- public IndicatorChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,OrganisationUnit orgUnit )
+
+ } // execute end
+
+ // Supporting Methods
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data only Period Wise start
+ // -------------------------------------------------------------------------
+
+ public IndicatorChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,
+ List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList, OrganisationUnit orgUnit )
throws Exception
- {
-
- System.out.println("inside function defination");
- IndicatorChartResult indicatorChartResult ;
-
+ {
+
+ IndicatorChartResult indicatorChartResult;
+
String[] series = new String[indicatorList.size()];
String[] categories = new String[selStartPeriodList.size()];
Double[][] data = new Double[indicatorList.size()][selStartPeriodList.size()];
+
+ Double[][] numDataArray = new Double[indicatorList.size()][selStartPeriodList.size()];
+ Double[][] denumDataArray = new Double[indicatorList.size()][selStartPeriodList.size()];
+
+ // Map<Integer, List<Double>> numData = new HashMap<Integer,
+ // List<Double>>();
+ // Map<Integer, List<Double>> denumData = new HashMap<Integer,
+ // List<Double>>();
+
String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
String xAxis_Title = "Time Line";
String yAxis_Title = "Value";
-
-
+
int serviceCount = 0;
- for ( Indicator indicator: indicatorList)
+ for ( Indicator indicator : indicatorList )
{
+ series[serviceCount] = indicator.getName();
+ yseriesList.add( indicator );
+
+ numeratorDEList.add( indicator.getNumeratorDescription() );
+ denominatorDEList.add( indicator.getDenominatorDescription() );
+
+ // List<Double> numeratorValueList = new ArrayList<Double>();
+ // List<Double> denumeratorValueList = new ArrayList<Double>();
+
int periodCount = 0;
for ( Date startDate : selStartPeriodList )
{
Date endDate = selEndPeriodList.get( periodCount );
-
+
categories[periodCount] = periodNames.get( periodCount );
-
+
Double aggIndicatorValue = 0.0;
+ Double aggIndicatorNumValue = 0.0;
+ Double aggIndicatorDenumValue = 0.0;
if ( aggDataCB != null )
{
-
- aggIndicatorValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate, orgUnit );
- if(aggIndicatorValue == null ) aggIndicatorValue = 0.0;
-
+
+ System.out.println( "aggDataCB checked " + aggDataCB );
+ System.out.println( "inside aggIndicatorValue" );
+
+ // System.out.println( "\n\nsize of OrgUnit List : " +
+ // selOUList.size()+ " , size of Indicator List : " +
+ // indicatorList.size() + "\n\nStart date : " + startDate +
+ // " , End date : " + endDate );
+
+ System.out.println( "\n\norgUnit : " + orgUnit );
+ System.out.println( "\n\nStart Date : " + startDate );
+ System.out.println( "\n\nEnd date : " + endDate );
+
+ System.out.println( "\n\nIndicator : " + indicator );
+ System.out.println( "\n\nIndicator Name : " + indicator.getName() );
+
+ aggIndicatorValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate,
+ orgUnit );
+
+ aggIndicatorNumValue = aggregationService.getAggregatedNumeratorValue( indicator, startDate,
+ endDate, orgUnit );
+ aggIndicatorDenumValue = aggregationService.getAggregatedDenominatorValue( indicator, startDate,
+ endDate, orgUnit );
+
+ if ( aggIndicatorValue == null )
+ aggIndicatorValue = 0.0;
+
}
else
{
- PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
- Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
-
- for ( Period period : periods )
- {
- aggIndicatorValue = dashBoardService.getIndividualIndicatorValue(indicator, orgUnit, period );
-
- }
- }
- data[serviceCount][periodCount] = aggIndicatorValue;
- periodCount++;
- }
- serviceCount++;
- }
- indicatorChartResult = new IndicatorChartResult( series,categories,data,chartTitle,xAxis_Title,yAxis_Title);
-
- return indicatorChartResult;
-
-}
-
-
-
-}
\ No newline at end of file
+ aggIndicatorValue = dashBoardService.getIndividualIndicatorValue( indicator, orgUnit, startDate,
+ endDate );
+
+ System.out.println( " \nIndicator Numerator value : " + indicator.getNumerator()
+ + ", Start Date :- " + startDate + ", End Date :- " + endDate + ", Org Unit :- " + orgUnit );
+
+ String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(), startDate,
+ endDate, orgUnit, "" );
+ System.out.println( " \nIndicatorNumerator valu is " + tempStr );
+
+ try
+ {
+ aggIndicatorNumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorNumValue = 0.0;
+ }
+
+ tempStr = reportService.getIndividualResultDataValue( indicator.getDenominator(), startDate,
+ endDate, orgUnit, "" );
+
+ try
+ {
+ aggIndicatorDenumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorDenumValue = 0.0;
+ }
+
+ }
+ data[serviceCount][periodCount] = aggIndicatorValue;
+ data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) )
+ / Math.pow( 10, 1 );
+
+ numDataArray[serviceCount][periodCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][periodCount] = aggIndicatorDenumValue;
+
+ // numeratorValueList.add( aggIndicatorNumValue );
+ // denumeratorValueList.add( aggIndicatorDenumValue );
+
+ periodCount++;
+ }
+
+ // numData.put( serviceCount, numeratorValueList );
+ // denumData.put( serviceCount, denumeratorValueList );
+
+ serviceCount++;
+ }
+
+ indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,
+ chartTitle, xAxis_Title, yAxis_Title );
+ return indicatorChartResult;
+
+ }
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data only Period Wise end
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data With Children Wise start
+ // -------------------------------------------------------------------------
+
+ public IndicatorChartResult generateChartDataWithChildrenWise( List<Date> selStartPeriodList,
+ List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,
+ List<OrganisationUnit> childOrgUnitList )
+ throws Exception
+ {
+ IndicatorChartResult indicatorChartResult;
+
+ String[] series = new String[indicatorList.size()];
+ String[] categories = new String[childOrgUnitList.size()];
+
+ Double[][] numDataArray = new Double[indicatorList.size()][childOrgUnitList.size()];
+ Double[][] denumDataArray = new Double[indicatorList.size()][childOrgUnitList.size()];
+ Double[][] data = new Double[indicatorList.size()][childOrgUnitList.size()];
+
+ String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
+
+ String xAxis_Title = "Facilities";
+ String yAxis_Title = "Value";
+
+ int serviceCount = 0;
+
+ for ( Indicator indicator : indicatorList )
+ {
+ series[serviceCount] = indicator.getName();
+ yseriesList.add( indicator );
+
+ numeratorDEList.add( indicator.getNumeratorDescription() );
+ denominatorDEList.add( indicator.getDenominatorDescription() );
+
+ int childCount = 0;
+ for ( OrganisationUnit orgChild : childOrgUnitList )
+ {
+
+ categories[childCount] = orgChild.getName();
+
+ Double aggIndicatorValue = 0.0;
+ Double aggIndicatorNumValue = 0.0;
+ Double aggIndicatorDenumValue = 0.0;
+ int periodCount = 0;
+ for ( Date startDate : selStartPeriodList )
+ {
+ Date endDate = selEndPeriodList.get( periodCount );
+
+ if ( aggDataCB != null )
+ {
+
+ Double tempAggIndicatorNumValue = aggregationService.getAggregatedNumeratorValue( indicator,
+ startDate, endDate, orgChild );
+ Double tempAggIndicatorDenumValue = aggregationService.getAggregatedDenominatorValue(
+ indicator, startDate, endDate, orgChild );
+
+ if ( tempAggIndicatorNumValue != null )
+ {
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ }
+ if ( tempAggIndicatorDenumValue != null )
+ {
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+
+ }
+ else
+ {
+ Double tempAggIndicatorNumValue = 0.0;
+ String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(),
+ startDate, endDate, orgChild, "" );
+ try
+ {
+ tempAggIndicatorNumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorNumValue = 0.0;
+ }
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ Double tempAggIndicatorDenumValue = 0.0;
+
+ tempStr = reportService.getIndividualResultDataValue( indicator.getDenominator(), startDate,
+ endDate, orgChild, "" );
+ try
+ {
+ tempAggIndicatorDenumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorDenumValue = 0.0;
+ }
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+
+ periodCount++;
+ }
+ try
+ {
+ // aggIndicatorValue = ( aggIndicatorNumValue /
+ // aggIndicatorDenumValue )*
+ // indicator.getIndicatorType().getFactor();
+ if ( aggIndicatorDenumValue == 0 )
+ {
+ aggIndicatorValue = 0.0;
+ }
+ else
+ {
+ aggIndicatorValue = (aggIndicatorNumValue / aggIndicatorDenumValue)
+ * indicator.getIndicatorType().getFactor();
+ }
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorValue = 0.0;
+ }
+
+ data[serviceCount][childCount] = aggIndicatorValue;
+ data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 1 ) )
+ / Math.pow( 10, 1 );
+
+ numDataArray[serviceCount][childCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][childCount] = aggIndicatorDenumValue;
+ // data[serviceCount][childCount] = aggDataValue;
+ childCount++;
+ }
+
+ serviceCount++;
+ }
+
+ indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,
+ chartTitle, xAxis_Title, yAxis_Title );
+ return indicatorChartResult;
+ }
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data With Children Wise end
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data With Selected Wise start
+ // -------------------------------------------------------------------------
+
+ public IndicatorChartResult generateChartDataSelectedOrgUnitWise( List<Date> selStartPeriodList,
+ List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,
+ List<OrganisationUnit> selOUList )
+ throws Exception
+ {
+ IndicatorChartResult indicatorChartResult;
+
+ String[] series = new String[indicatorList.size()];
+ String[] categories = new String[selOUList.size()];
+
+ Double[][] numDataArray = new Double[indicatorList.size()][selOUList.size()];
+ Double[][] denumDataArray = new Double[indicatorList.size()][selOUList.size()];
+ Double[][] data = new Double[indicatorList.size()][selOUList.size()];
+ String chartTitle = "OrganisationUnit : -----";
+
+ String xAxis_Title = "Facilities";
+ String yAxis_Title = "Value";
+
+ int serviceCount = 0;
+
+ for ( Indicator indicator : indicatorList )
+ {
+ series[serviceCount] = indicator.getName();
+ yseriesList.add( indicator );
+
+ numeratorDEList.add( indicator.getNumeratorDescription() );
+ denominatorDEList.add( indicator.getDenominatorDescription() );
+
+ int orgUnitCount = 0;
+ for ( OrganisationUnit orgUnit : selOUList )
+ {
+ categories[orgUnitCount] = orgUnit.getName();
+
+ Double aggIndicatorValue = 0.0;
+ Double aggIndicatorNumValue = 0.0;
+ Double aggIndicatorDenumValue = 0.0;
+
+ int periodCount = 0;
+ for ( Date startDate : selStartPeriodList )
+ {
+ Date endDate = selEndPeriodList.get( periodCount );
+
+ if ( aggDataCB != null )
+ {
+ Double tempAggIndicatorNumValue = aggregationService.getAggregatedNumeratorValue( indicator,
+ startDate, endDate, orgUnit );
+ Double tempAggIndicatorDenumValue = aggregationService.getAggregatedDenominatorValue(
+ indicator, startDate, endDate, orgUnit );
+
+ if ( tempAggIndicatorNumValue != null )
+ {
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ }
+ if ( tempAggIndicatorDenumValue != null )
+ {
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+
+ }
+ else
+ {
+
+ Double tempAggIndicatorNumValue = 0.0;
+
+ String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(),
+ startDate, endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorNumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorNumValue = 0.0;
+ }
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ // System.out.println( " \nAggIndicator Num Value : " +
+ // aggIndicatorNumValue );
+
+ Double tempAggIndicatorDenumValue = 0.0;
+
+ tempStr = reportService.getIndividualResultDataValue( indicator.getDenominator(), startDate,
+ endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorDenumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorDenumValue = 0.0;
+ }
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+ // System.out.println( " \nAggIndicator Denum Value : "
+ // + aggIndicatorDenumValue );
+
+ }
+
+ periodCount++;
+ }
+
+ try
+ {
+ // aggIndicatorValue = ( aggIndicatorNumValue /
+ // aggIndicatorDenumValue )*
+ // indicator.getIndicatorType().getFactor();
+ if ( aggIndicatorDenumValue == 0 )
+ {
+ aggIndicatorValue = 0.0;
+ }
+ else
+ {
+ aggIndicatorValue = (aggIndicatorNumValue / aggIndicatorDenumValue)
+ * indicator.getIndicatorType().getFactor();
+ }
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorValue = 0.0;
+ }
+
+ data[serviceCount][orgUnitCount] = aggIndicatorValue;
+ data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) )
+ / Math.pow( 10, 1 );
+
+ numDataArray[serviceCount][orgUnitCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][orgUnitCount] = aggIndicatorDenumValue;
+
+ // data[serviceCount][orgUnitCount] = aggDataValue;
+ orgUnitCount++;
+
+ }
+
+ serviceCount++;
+ }
+
+ indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,
+ chartTitle, xAxis_Title, yAxis_Title );
+ return indicatorChartResult;
+ }
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data With Selected Wise end
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data OrgGroup Period Wise start
+ // -------------------------------------------------------------------------
+
+ public IndicatorChartResult generateChartDataOrgGroupPeriodWise( List<Date> selStartPeriodList,
+ List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,
+ List<OrganisationUnit> selOUGroupMemberList )
+ throws Exception
+ {
+ IndicatorChartResult indicatorChartResult;
+
+ String[] series = new String[indicatorList.size()];
+ String[] categories = new String[selStartPeriodList.size()];
+
+ Double[][] numDataArray = new Double[indicatorList.size()][selStartPeriodList.size()];
+ Double[][] denumDataArray = new Double[indicatorList.size()][selStartPeriodList.size()];
+ Double[][] data = new Double[indicatorList.size()][selStartPeriodList.size()];
+
+ String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName() + "(" + selOrgUnitGroup.getName()
+ + ")";
+ String xAxis_Title = "Time Line";
+ String yAxis_Title = "Value";
+
+ int serviceCount = 0;
+
+ for ( Indicator indicator : indicatorList )
+ {
+ series[serviceCount] = indicator.getName();
+ yseriesList.add( indicator );
+
+ numeratorDEList.add( indicator.getNumeratorDescription() );
+ denominatorDEList.add( indicator.getDenominatorDescription() );
+
+ Double aggIndicatorValue = 0.0;
+ Double aggIndicatorNumValue = 0.0;
+ Double aggIndicatorDenumValue = 0.0;
+
+ int periodCount = 0;
+ for ( Date startDate : selStartPeriodList )
+ {
+ Date endDate = selEndPeriodList.get( periodCount );
+ categories[periodCount] = periodNames.get( periodCount );
+
+ int orgGroupCount = 0;
+
+ for ( OrganisationUnit orgUnit : selOUGroupMemberList )
+ {
+ if ( aggDataCB != null )
+ {
+ Double tempAggIndicatorNumValue = aggregationService.getAggregatedNumeratorValue( indicator,
+ startDate, endDate, orgUnit );
+ Double tempAggIndicatorDenumValue = aggregationService.getAggregatedDenominatorValue(
+ indicator, startDate, endDate, orgUnit );
+
+ if ( tempAggIndicatorNumValue != null )
+ {
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ }
+ if ( tempAggIndicatorDenumValue != null )
+ {
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+
+ }
+ else
+ {
+
+ Double tempAggIndicatorNumValue = 0.0;
+
+ String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(),
+ startDate, endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorNumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorNumValue = 0.0;
+ }
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ Double tempAggIndicatorDenumValue = 0.0;
+
+ // tempStr =
+ // reportService.getIndividualResultIndicatorValue(
+ // indicator.getDenominator(), startDate, endDate,
+ // orgUnit );
+ tempStr = reportService.getIndividualResultDataValue( indicator.getDenominator(), startDate,
+ endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorDenumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorDenumValue = 0.0;
+ }
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+ orgGroupCount++;
+ }
+
+ try
+ {
+ // aggIndicatorValue = ( aggIndicatorNumValue /
+ // aggIndicatorDenumValue )*
+ // indicator.getIndicatorType().getFactor();
+ if ( aggIndicatorDenumValue == 0 )
+ {
+ aggIndicatorValue = 0.0;
+ }
+ else
+ {
+ aggIndicatorValue = (aggIndicatorNumValue / aggIndicatorDenumValue)
+ * indicator.getIndicatorType().getFactor();
+ }
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorValue = 0.0;
+ }
+
+ data[serviceCount][periodCount] = aggIndicatorValue;
+ data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) )
+ / Math.pow( 10, 1 );
+
+ numDataArray[serviceCount][periodCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][periodCount] = aggIndicatorDenumValue;
+ periodCount++;
+ }
+
+ serviceCount++;
+ }
+
+ indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,
+ chartTitle, xAxis_Title, yAxis_Title );
+ return indicatorChartResult;
+
+ }
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data OrgGroup Period Wise end
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data OrgGroup Selected orgUnit Wise start
+ // -------------------------------------------------------------------------
+
+ public IndicatorChartResult generateChartDataSelectedOrgUnitGroupWise( List<Date> selStartPeriodList,
+ List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,
+ Map<OrganisationUnitGroup, List<OrganisationUnit>> orgUnitGroupMap )
+ throws Exception
+ {
+ IndicatorChartResult indicatorChartResult;
+
+ String[] series = new String[indicatorList.size()];
+ String[] categories = new String[orgUnitGroupMap.keySet().size()];
+
+ Double[][] numDataArray = new Double[indicatorList.size()][orgUnitGroupMap.keySet().size()];
+ Double[][] denumDataArray = new Double[indicatorList.size()][orgUnitGroupMap.keySet().size()];
+ Double[][] data = new Double[indicatorList.size()][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 ( Indicator indicator : indicatorList )
+ {
+
+ series[serviceCount] = indicator.getName();
+
+ yseriesList.add( indicator );
+
+ numeratorDEList.add( indicator.getNumeratorDescription() );
+ denominatorDEList.add( indicator.getDenominatorDescription() );
+
+ int orgGroupCount = 0;
+ for ( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
+ {
+ Double aggIndicatorValue = 0.0;
+ Double aggIndicatorNumValue = 0.0;
+ Double aggIndicatorDenumValue = 0.0;
+
+ categories[orgGroupCount] = orgUnitGroup.getName();
+
+ if ( serviceCount == 0 )
+ {
+ chartTitle += orgUnitGroup.getName() + ",";
+ }
+ Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroupMap.get( orgUnitGroup );
+ if ( orgUnitGroupMembers == null || orgUnitGroupMembers.size() == 0 )
+ {
+ numDataArray[serviceCount][orgGroupCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][orgGroupCount] = aggIndicatorDenumValue;
+ data[serviceCount][orgGroupCount] = aggIndicatorValue;
+
+ orgGroupCount++;
+ continue;
+ }
+ for ( OrganisationUnit orgUnit : orgUnitGroupMembers )
+ {
+ int periodCount = 0;
+ for ( Date startDate : selStartPeriodList )
+ {
+ Date endDate = selEndPeriodList.get( periodCount );
+
+ if ( aggDataCB != null )
+ {
+ Double tempAggIndicatorNumValue = aggregationService.getAggregatedNumeratorValue(
+ indicator, startDate, endDate, orgUnit );
+ Double tempAggIndicatorDenumValue = aggregationService.getAggregatedDenominatorValue(
+ indicator, startDate, endDate, orgUnit );
+
+ if ( tempAggIndicatorNumValue != null )
+ {
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+
+ }
+ if ( tempAggIndicatorDenumValue != null )
+ {
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+
+ }
+
+ }
+ else
+ {
+
+ // System.out.println(
+ // " \ninside aggdata not checked" );
+ Double tempAggIndicatorNumValue = 0.0;
+
+ String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(),
+ startDate, endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorNumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorNumValue = 0.0;
+ }
+ aggIndicatorNumValue += tempAggIndicatorNumValue;
+ // System.out.println(
+ // " \nAggIndicator Num Value : " +
+ // aggIndicatorNumValue );
+
+ Double tempAggIndicatorDenumValue = 0.0;
+
+ tempStr = reportService.getIndividualResultDataValue( indicator.getDenominator(),
+ startDate, endDate, orgUnit, "" );
+ try
+ {
+ tempAggIndicatorDenumValue = Double.parseDouble( tempStr );
+ }
+ catch ( Exception e )
+ {
+ tempAggIndicatorDenumValue = 0.0;
+ }
+ aggIndicatorDenumValue += tempAggIndicatorDenumValue;
+ // System.out.println(
+ // " \nAggIndicator Denum Value : " +
+ // aggIndicatorDenumValue );
+ }
+
+ periodCount++;
+ }
+
+ }// orgunit member
+ try
+ {
+
+ if ( aggIndicatorDenumValue == 0 )
+ {
+ aggIndicatorValue = 0.0;
+ }
+ else
+ {
+ aggIndicatorValue = (aggIndicatorNumValue / aggIndicatorDenumValue)
+ * indicator.getIndicatorType().getFactor();
+ }
+ }
+ catch ( Exception e )
+ {
+ aggIndicatorValue = 0.0;
+ }
+
+ data[serviceCount][orgGroupCount] = aggIndicatorValue;
+
+ // System.out.println(
+ // " \nAgg Indicator Value Before Rounding : " +
+ // data[serviceCount][orgGroupCount] );
+
+ data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) )
+ / Math.pow( 10, 1 );
+
+ // System.out.println(
+ // " \nAgg Indicator Value After Rounding : " +
+ // data[serviceCount][orgGroupCount] );
+
+ numDataArray[serviceCount][orgGroupCount] = aggIndicatorNumValue;
+ denumDataArray[serviceCount][orgGroupCount] = aggIndicatorDenumValue;
+
+ orgGroupCount++;
+ }
+
+ serviceCount++;
+ }
+
+ indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,
+ chartTitle, xAxis_Title, yAxis_Title );
+
+ return indicatorChartResult;
+
+ }
+ // -------------------------------------------------------------------------
+ // Methods for getting Chart Data OrgGroup Selected orgUnit Wise end
+ // -------------------------------------------------------------------------
+
+}
\ No newline at end of file
=== 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-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/charts/Vertical3DBarChart.java 2010-11-22 13:02:23 +0000
@@ -142,7 +142,15 @@
@SuppressWarnings("deprecation")
public JFreeChart getChartViewergetChartViewerDataElement( double[][] data1, String[] series1, String[] categories1, String chartTitle, String xAxis_Title, String yAxis_Title )
{
+/* System.out.println( "\n\ndataset1 : " + data1.length );
+ System.out.println( "\n\nseries1 : " + series1.length );
+ System.out.println( "\n\ncategories1 : " + categories1.length );
+ System.out.println( "\n\nchartTitle : " + chartTitle );
+ System.out.println( "\n\nxAxis_Title : " + xAxis_Title );
+ System.out.println( "\n\nyAxis_Title : " + yAxis_Title );
+*/
DefaultCategoryDataset dataset1 = getDataset( data1, series1, categories1 );
+
// create the chart...
final JFreeChart chart = ChartFactory.createBarChart3D( "", // chart
// title
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java 2010-11-22 13:02:23 +0000
@@ -723,15 +723,15 @@
return periodNameList;
}
- public double getIndividualIndicatorValue( Indicator indicator, OrganisationUnit orgunit, Period period )
+ public double getIndividualIndicatorValue( Indicator indicator, OrganisationUnit orgunit, Date startDate, Date endDate )
{
String numeratorExp = indicator.getNumerator();
String denominatorExp = indicator.getDenominator();
int indicatorFactor = indicator.getIndicatorType().getFactor();
- String reportModelTB = null;
- String numeratorVal = reportservice.getIndividualResultDataValue( numeratorExp, period.getStartDate(), period.getEndDate(), orgunit, reportModelTB );
- String denominatorVal = reportservice.getIndividualResultDataValue( denominatorExp, period.getStartDate(), period.getEndDate(), orgunit, reportModelTB );
+ String reportModelTB = "";
+ String numeratorVal = reportservice.getIndividualResultDataValue( numeratorExp, startDate, endDate, orgunit, reportModelTB );
+ String denominatorVal = reportservice.getIndividualResultDataValue( denominatorExp, startDate, endDate, orgunit, reportModelTB );
double numeratorValue;
try
@@ -756,7 +756,15 @@
double aggregatedValue;
try
{
- aggregatedValue = ( numeratorValue / denominatorValue ) * indicatorFactor;
+ //aggregatedValue = ( numeratorValue / denominatorValue ) * indicatorFactor;
+ if( denominatorValue == 0 )
+ {
+ aggregatedValue = 0.0;
+ }
+ else
+ {
+ aggregatedValue = ( numeratorValue / denominatorValue ) * indicatorFactor;
+ }
}
catch ( Exception e )
{
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java 2010-11-22 13:02:23 +0000
@@ -26,6 +26,7 @@
*/
package org.hisp.dhis.dashboard.util;
+
/**
* @author Mithilesh Kumar Thakur
*
@@ -43,11 +44,15 @@
}
- public IndicatorChartResult( String[] series, String[] categories, Double data[][],String chartTitle,String xAxis_Title,String yAxis_Title )
+ public IndicatorChartResult( String[] series, String[] categories, Double data[][],Double numDataArray[][],Double denumDataArray[][],String chartTitle,String xAxis_Title,String yAxis_Title )
{
this.series = series;
this.categories = categories;
this.data = data;
+ this.numDataArray = numDataArray;
+ this.denumDataArray = denumDataArray;
+ // this.numData = numData;
+ // this.denumData = denumData;
this.chartTitle = chartTitle;
this.xAxis_Title = xAxis_Title;
this.yAxis_Title = yAxis_Title;
@@ -56,9 +61,6 @@
}
-
-
-
//---------------------------------------------------------------
// Getters and Setters
//---------------------------------------------------------------
@@ -100,6 +102,58 @@
this.data = data;
}
+
+ Double numDataArray[][];
+
+ public Double[][] getNumDataArray()
+ {
+ return numDataArray;
+ }
+
+ public void setNumDataArray( Double[][] numDataArray )
+ {
+ this.numDataArray = numDataArray;
+ }
+
+ Double denumDataArray[][];
+
+ public Double[][] getDenumDataArray()
+ {
+ return denumDataArray;
+ }
+
+ public void setDenumDataArray( Double[][] denumDataArray )
+ {
+ this.denumDataArray = denumDataArray;
+ }
+
+
+ /*
+ public Map<Integer, List<Double>> numData;
+
+
+ public Map<Integer, List<Double>> getNumData()
+ {
+ return numData;
+ }
+
+ public void setNumData( Map<Integer, List<Double>> numData )
+ {
+ this.numData = numData;
+ }
+
+ public Map<Integer, List<Double>> denumData;
+
+ public Map<Integer, List<Double>> getDenumData()
+ {
+ return denumData;
+ }
+
+ public void setDenumData( Map<Integer, List<Double>> denumData )
+ {
+ this.denumData = denumData;
+ }
+*/
private String chartTitle;
public String getChartTitle()
=== 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-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-11-22 13:02:23 +0000
@@ -68,7 +68,12 @@
scope="prototype">
</bean>
- <!-- Export Data Elements to Excel -->
+<!-- sorting DataElement data -->
+ <bean id="org.hisp.dhis.dashboard.action.GetSortedDataElementAction"
+ class="org.hisp.dhis.dashboard.action.GetSortedDataElementAction"
+ 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">
@@ -77,48 +82,64 @@
</property>
</bean>
- <!-- Graphical Analyser Indicator Result -->
+
+
+
+<!-- Graphical Analyser DataElements End -->
+
+<!-- Graphical Analyser Indicators Start-->
+
+ <bean id="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
+ class="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
+ scope="prototype">
+ <property name="indicatorService">
+ <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
+ </property>
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.period.PeriodService"/>
+ </property>
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+
+ </bean>
+
+ <!-- Graphical Analyser Indicator Result -->
<bean id="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartIndicatorAction"
class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartIndicatorAction"
scope="prototype">
<property name="statementManager" ref="statementManager"/>
- <property name="dashBoardService" ref="org.hisp.dhis.dashboard.util.DashBoardService">
- </property>
+ <property name="dashBoardService" ref="org.hisp.dhis.dashboard.util.DashBoardService">
+ </property>
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService">
</property>
+ <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
+ </property>
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
</property>
- <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService">
- </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>
-
-
-<!-- Graphical Analyser DataElements End -->
-
-<!-- Graphical Analyser Indicators Start-->
-
- <bean id="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
- class="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
- scope="prototype">
- <property name="indicatorService">
- <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
- </property>
- <property name="periodService">
- <ref bean="org.hisp.dhis.period.PeriodService"/>
- </property>
- <property name="organisationUnitGroupService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
- </property>
-
- </bean>
-
+<!-- <property name="periodService" ref="org.hisp.dhis.period.PeriodService">
+ </property>-->
+ </bean>
+<!-- sorting Indiacator data -->
+ <bean id="org.hisp.dhis.dashboard.action.GetSortedIndicatorDataAction"
+ class="org.hisp.dhis.dashboard.action.GetSortedIndicatorDataAction"
+ scope="prototype">
+ </bean>
+<!-- Export Indicator to Excel -->
+ <bean id="org.hisp.dhis.dashboard.action.ExportIndicatorToExcelAction"
+ class="org.hisp.dhis.dashboard.action.ExportIndicatorToExcelAction"
+ scope="prototype">
+
+ <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
+ </property>
+ </bean>
<!-- Graphical Analyser Indicators End-->
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2010-11-22 13:02:23 +0000
@@ -27,7 +27,7 @@
ga_orgunitgroupset = OrgunitGroupSet
dashboard = DashBoard
graphical_analysis = Graphical Analysis
-dataelements_wise = Data Element Wise
+dataelements_wise = DataElement Wise
dataelements_wise_graphical_analyser = Data Elements wise Graphical Analyser
periodType = Period Type
year = Year
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-11-22 13:02:23 +0000
@@ -50,6 +50,13 @@
</result>
</action>
+ <!-- sorting DataElement data -->
+ <action name="getSortedDataElement"
+ class="org.hisp.dhis.dashboard.action.GetSortedDataElementAction">
+ <result name="success" type="velocity-xml">/dhis-web-dashboard/responseSortedData.vm</result>
+ <!--<interceptor-ref name="transactionStack"/>-->
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
<!-- Export Data Elements to Excel -->
<action name="exportDataElementsToExcel"
class="org.hisp.dhis.dashboard.action.ExportDataElementToExcelAction">
@@ -82,8 +89,23 @@
<param name="stylesheets">css/StylesForTags.css</param>
<interceptor-ref name="organisationUnitTreeStack"/>
</action>
-
-
+<!-- sorting Indiacator data -->
+ <action name="getSortedIndicatorData"
+ class="org.hisp.dhis.dashboard.action.GetSortedIndicatorDataAction">
+ <result name="success" type="velocity-xml">/dhis-web-dashboard/responseSortedData.vm</result>
+ <!--<interceptor-ref name="transactionStack"/>-->
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+<!-- Export Indicator data to Excel -->
+ <action name="exportIndicatorToExcel"
+ class="org.hisp.dhis.dashboard.action.ExportIndicatorToExcelAction">
+ <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 Indicators end -->
=== 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-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm 2010-11-22 13:02:23 +0000
@@ -63,7 +63,7 @@
request.setCallbackSuccess( getSortedListReceived );
//request.send( url );
- var requestString = "getSortedData.action";
+ var requestString = "getSortedDataElement.action";
var params = "chartDisplayOption=" + chartDisplayOptionValue;
request.sendAsPost( params );
request.send( requestString );
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-11-22 13:02:23 +0000
@@ -37,7 +37,7 @@
<h1>$i18n.getString( "indicator_wise_graphical_analyser" )</h1>
<hr />
-<form id="ChartGenerationForm" name="ChartGenerationForm" action="generateChartIndicator.action" method="post" onSubmit="return formValidationsIndicator()" >
+<form id="ChartGenerationForm" name="ChartGenerationForm" action="generateChartIndicator.action" method="post" onSubmit="return formValidationsIndicator()" target="chartWindowIndicator">
<table style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" border=0>
<tr>
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 2010-11-22 13:02:23 +0000
@@ -34,10 +34,10 @@
var chartTypeOptionList = document.getElementById("chartTypeOption");
var chartTypeOptionValue = chartTypeOptionList.options[ chartTypeOptionList.selectedIndex ].value;
-
+ // alert(chartTypeOptionValue);
var chartDisplayOptionList = document.getElementById("chartDisplayOption");
var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
-
+ // alert(chartDisplayOptionValue);
// iframeForChart.location.href = "generateChart1.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;
iframeForChart.location.href = "generateChart1.action?currentChart="+chartTypeOptionValue+"&chartDisplayOption="+chartDisplayOptionValue;
@@ -61,8 +61,9 @@
request.setResponseTypeXML( 'messages' );
request.setCallbackSuccess( getSortedListReceived );
//request.send( url );
-
- var requestString = "getSortedData.action";
+
+ // alert("inside sorting function");
+ var requestString = "getSortedIndicatorData.action";
var params = "chartDisplayOption=" + chartDisplayOptionValue;
request.sendAsPost( params );
request.send( requestString );
@@ -88,11 +89,11 @@
function exportToExcelFunction1( summaryOption )
{
- //alert("inside Viw Summary:" + summaryOption );
+ //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;
+ document.getElementById("exportExcelAnchor1").href="exportIndicatorToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
}
@@ -111,7 +112,7 @@
var chartDisplayOptionList = document.getElementById("chartDisplayOption");
var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
- document.getElementById("exportExcelAnchor2").href="exportDataElementsToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+ document.getElementById("exportExcelAnchor2").href="exportIndicatorToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
}
@@ -120,7 +121,7 @@
<table>
<tr>
<td class="NormalB">
- #if($selectedButton.equals("ViewSummary"))
+ #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">
@@ -131,10 +132,11 @@
<option value="alphabet">Alphabetical</option>
</select>
- <br><br>
+
</td>
+
</tr>
- #else
+ #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"> <!--<font face="Arial, Helvetica, sans-serif" color="#000000">-->
@@ -154,78 +156,84 @@
</select>
</td>
</tr>
- #end
-</table>
+ #end
+ </table>
</div>
<div id="formResult">
-<!--
- <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
+<div id="headingInfoId">
+<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">
+ <tr>
+ <td class="TableHeadingCellStyles" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" rowspan="2"><strong>Indicator Names</strong></td>
+ #foreach($xaxisvalue in $indicatorChartResult.categories)
+ <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" colspan="3"><strong>$xaxisvalue</strong></td>
+ #end
+ </tr>
+ <tr>
+
+ #foreach($xaxisvalue in $indicatorChartResult.categories)
+ <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Num</strong></td>
+ <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Den</strong></td>
+ <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Val</strong></td>
+ #end
+ </tr>
+ #set( $numValCimpleteResult = $indicatorChartResult.numDataArray )
+ #set( $denumValCimpleteResult = $indicatorChartResult.denumDataArray )
+ #set($count1 = 0)
+ #foreach($onedataList in $indicatorChartResult.data )
+
+ <tr>
+ <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1).name</td>
+
+ #set( $numValList = $listTool.get($numValCimpleteResult, $count1) )
+ #set( $denumValList = $listTool.get($denumValCimpleteResult, $count1) )
+ #set( $count2 = 0 )
+ #foreach($data in $onedataList)
+
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$listTool.get($numValList, $count2)</td>
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$listTool.get($denumValList, $count2)</td>
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
+
+ #set( $count2 = $count2 + 1 )
+ #end
+
+ </tr>
+ #set( $count1 = $count1 + 1 )
+ #end
</table>
</div>
--->
-<!-- #if($selectedButton.equals("ViewSummary"))
+</div>
+#if($selectedButton.equals("ViewSummary"))
<br><br>
- #else-->
- <br>
+ #else
+ <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
+ <br>
+#end
</div>
-<!--
- <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"> X $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>
-
-<!--
- <textarea id="testId" rows="10" cols="70" style="display:none"> </textarea> -->
- </form>
->
-
\ No newline at end of file
+
+ <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" 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"><strong>Indicator Names</strong></td>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" 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"><strong>Formula</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" 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"><strong>Numerator DataElements</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" 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"><strong>Denominator DataElements</strong></td>
+ </tr>
+ #set($count1 = 0)
+ #foreach($service in $yseriesList )
+ <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"> X $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>
+
+
+ <textarea id="testId" rows="10" cols="70" style="display:none"> </textarea>
+</form>
=== 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-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-11-22 13:02:23 +0000
@@ -406,14 +406,14 @@
orgUnitListCB.options[k].selected = true;
}
}
-/*
+
var sWidth = 1000;
var sHeight = 1000;
var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
- window.open('','chartWindowDataElement','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');
-*/
+ window.open('','chartWindowIndicator','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');
+
return true;
}
// formValidations Function Indicators End