Changeset 1501

Show
Ignore:
Timestamp:
11/30/08 08:26:56 (5 weeks ago)
Author:
amostafa
Message:
 
Location:
branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/CurrentTemplate.java

    r1452 r1501  
    22 
    33import java.util.Vector; 
     4 
     5import org.javarosa.patient.model.Patient; 
    46 
    57 /*  
     
    1214        public static final String CURRENT_TEMPLATE_NAME = "CurrentGraph"; 
    1315        public static boolean isUseTemplate=false; //brotecs:add this 
    14  
     16        private Patient patient; 
    1517        /* 
    1618         * (non-Javadoc) 
     
    5860                return isUseTemplate; 
    5961        } 
     62         
     63        public Patient getPatient() { 
     64                return this.patient; 
     65        } 
    6066} 
  • branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/IGraphTemplate.java

    r1452 r1501  
    22 
    33import java.util.Vector; 
     4 
     5import org.javarosa.patient.model.Patient; 
    46 
    57public interface IGraphTemplate { 
     
    2527         */ 
    2628        Vector getLines(Vector data,LineChart chart); 
     29        public Patient getPatient();  
    2730        //public void setIsUseTemplate(boolean isUseTemplate); 
    2831        //public boolean getIsUseTemplate(); 
  • branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/LineChart.java

    r1452 r1501  
    8282            templatemarginOne=36;//brotecs 
    8383            templatexScaleFactor=13;//brotecs 
    84            // System.out.println("Brotecs::LineChart->LineChart(String label, Style style)"); 
    8584    } 
    8685     
     
    160159            g1.setColor(0, 0, 0); 
    161160            g1.drawLine(marginOne, this.height - marginFour, marginOne + width, this.height - marginFour); 
    162             //System.out.println("Line 1->X1:"+marginOne+" Y1:"+(this.height - marginFour)+" X2:"+(marginOne+width)+" Y2:"+(this.height - marginFour)); 
    163161            g1.drawLine(marginOne, this.height - marginFour, marginOne, this.height - marginFour - height); 
    164             //System.out.println("Line 2->X1:"+marginOne+" Y1:"+(this.height - marginFour)+" X2:"+marginOne+" Y2:"+(this.height - marginFour - height)); 
    165162             
    166163        } 
     
    252249        int l = this.width - marginOne; 
    253250        int i1 = this.height - fontSpaceHeight; 
    254         //System.out.println("Brotecs::LineChart->this.width ==> " + this.width + " this.height == " + this.height + " l = " + l + " i1 == " + i1); 
    255251        g.setFont(font); 
    256252        g.setColor(255, 255, 255); 
     
    302298            for(int i = 0; i <= height; i += 10) { 
    303299                int j1 = this.height - fontSpaceHeight - i; 
    304                 //System.out.println("Brotecs::LineChart->marginOne:"+marginOne+"j1:"+j1+"marginOne-2"+(marginOne-2)); 
    305300                g.drawLine(marginOne, j1, marginOne - 2, j1); //draw Y axis "-"  
    306301                int point = (yScaleFactor * i) / height; 
    307                 //System.out.println("Brotecs::LineChart->drawChart:"+point+"="+yScaleFactor+"*"+i+"/"+height); 
    308302                pointLabelWidth = font.stringWidth(String.valueOf(point)); 
    309303                 
     
    325319    
    326320   public void drawLine(Graphics g, Vector pointVector) { 
    327            //System.out.println("Brotecs::LineChart->drawLine:pointVector.size()="+pointVector.size()); 
    328321       pointVector.size(); 
    329322       int count = -1; 
     
    357350           int pointY2 = this.height - fontSpaceHeight - (height * b1.yCordPt) / (yScaleFactor); 
    358351            
    359            //System.out.println("Brotecs::pointY2->this.height:"+this.height +"- fontSpaceHeight:"+fontSpaceHeight+" - (height:"+height+" * b1.yCordPt:" +  b1.yCordPt + ") / yScaleFactor:"+yScaleFactor); 
    360352           //int pointX2 = marginOne + (width * b1.xCordPt) / (xScaleFactor * scaleFactor); 
    361353           /************Brotecs*************/ 
    362354           int pointX2; 
    363            if(defaulttemplate){// 
    364                    pointX2 = marginOne + (width * b1.xCordPt) / (templatexScaleFactor * scaleFactor); 
     355           if(defaulttemplate){             
     356                   pointX2 = marginOne + (width * b1.xCordPt) / (templatexScaleFactor * 6); 
    365357           } 
    366358           else 
     
    369361           } 
    370362            
    371           // System.out.println("Brotecs::pointX2->marginOne:"+marginOne+"+(width:"+width+"* b1.xCordPt:"+b1.xCordPt+") / (xScaleFactor:"+xScaleFactor+"* scaleFactor:"+scaleFactor+")"); 
    372            /************Brotecs*************/ 
    373            //System.out.println("pointX1 ==  " + pointX1 + " pointY1 == " + pointY1 + " pointX2 == " + pointX2 + " pointY2 == " + pointY2); 
    374             
     363           /************Brotecs*************/            
    375364           if(count > -1) { 
    376365               g.drawLine(pointX1, pointY1, pointX2, pointY2); 
    377                //System.out.println("Brotecs::LineChart->pointX1:"+pointX1+" pointY1:"+pointY1+" pointX2:"+pointX2+" pointY2:"+pointY2); 
    378366           } 
    379367           pointX1 = pointX2; 
     
    390378                   else{ 
    391379                       if((count + 1) % ticker == 0) { 
    392                            //g.drawLine(pointX2, this.height - fontSpaceHeight, pointX2, (this.height - fontSpaceHeight) + 4); 
    393                             
     380                           //g.drawLine(pointX2, this.height - fontSpaceHeight, pointX2, (this.height - fontSpaceHeight) + 4);    
    394381                       } 
    395382                       pointLabelWidth = font.stringWidth(b1.labelX); 
    396383                       if(isLabelXTrue && (count + 1) % (equalCoordTicker * ticker) == 0) { 
    397384                           //g.drawString(b1.labelX, pointX2 - pointLabelWidth / 2, (this.height - fontSpaceHeight) + 1, 20); 
    398            
    399385                       } 
    400386                   } 
  • branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/WHOWeightTemplate.java

    r1452 r1501  
    2525        public static boolean isUseTemplate=false; //brotecs:add this 
    2626        private Patient patient; 
    27  
     27        public int age;  
    2828        /* 
    2929         * (non-Javadoc) 
     
    5555                Vector points2 = new Vector(); 
    5656                Vector points3 = new Vector(); 
    57                  
    5857                lines.addElement(points1);/*Brotecs*/ 
    5958                lines.addElement(points3);/*Brotecs*/ 
    6059                lines.addElement(points2); 
    61                  
    62  
    63          
    6460        Date birthdate=patient.getBirthDate(); 
    65          
    6661        Date today=new Date(); 
    6762        Calendar calendar = Calendar.getInstance(); 
    6863                calendar.setTime(today); 
    6964                int thisYear = calendar.get(Calendar.YEAR); 
    70                 System.out.println("towhid::::WHOWeightTemplate:thisYear="+thisYear); 
    7165                calendar.setTime(birthdate); 
    7266                int birthYear = calendar.get(Calendar.YEAR); 
    73                 System.out.println("towhid::::WHOWeightTemplate:birthYear="+birthYear); 
    74                  
    7567                int diff_year = thisYear-birthYear; 
    76                 System.out.println("towhid::::WHOWeightTemplate:diff_year="+diff_year); 
    77                 if(diff_year<5){ 
     68                age=diff_year; 
     69                if(diff_year<=5){ 
    7870                        if(patient.getGender()==patient.SEX_MALE){ 
    7971                                 
     
    8779                        int [] chartY3PointsArray = {0, 2, 4, 11, 20, 26, 34, 42, 58}; 
    8880                         
    89                                 System.out.println("towhid::::WHOWeightTemplate:Gender=MALE");        
     81                                //System.out.println("towhid::::WHOWeightTemplate:Gender=MALE");        
    9082                        for(int i = 0; i < chartX2PointsArray.length; i++) { 
    9183                                points2.addElement(new LinePointsItem("", chartX2PointsArray[i], chartY2PointsArray[i], 0,  255, 255)); 
     
    10799                                int [] chartY1PointsArray = {4, 6, 9, 12, 13, 14, 19, 22, 25}; 
    108100                        int [] chartX1PointsArray = {0, 1, 5, 14, 16, 19, 39, 50, 60}; 
    109                                  
    110101                                int [] chartY2PointsArray = {3, 5, 7,  9, 11, 13, 15, 17, 18}; 
    111102                        int [] chartX2PointsArray = {0, 2, 5, 12, 20, 31, 42, 55, 59}; 
    112                          
    113103                        int [] chartY3PointsArray = {2, 4, 5, 7, 8, 9, 10, 13, 14}; 
    114104                        int [] chartX3PointsArray = {0, 2, 4, 12, 17, 24, 30, 53, 59}; 
    115                          
    116                                 System.out.println("towhid::::WHOWeightTemplate:Gender=FEMALE"); 
     105                                //System.out.println("towhid::::WHOWeightTemplate:Gender=FEMALE"); 
    117106                                for(int i = 0; i < chartX3PointsArray.length; i++) { 
    118107                                points3.addElement(new LinePointsItem("", chartY3PointsArray[i], chartX3PointsArray[i], 0,  255, 255)); 
     
    132121                                int [] chartX1PointsArray = {5, 6, 8, 12, 13, 15, 17, 19, 23}; 
    133122                        int [] chartY1PointsArray = {0, 1, 2, 12, 16, 23, 31, 39, 60}; 
    134                                  
    135123                                int [] chartX2PointsArray = {3, 5, 9, 10, 11, 13, 15, 17, 18}; 
    136124                        int [] chartY2PointsArray = {0, 2, 10, 14, 18, 28, 40, 52, 56}; 
    137                          
    138125                        int [] chartX3PointsArray = {2, 4, 5, 8, 9, 10, 11, 12, 14}; 
    139126                        int [] chartY3PointsArray = {0, 2, 4, 11, 20, 26, 34, 42, 58}; 
     
    168155                this.patient = patient; 
    169156        } 
     157        public Patient getPatient() { 
     158                return this.patient; 
     159        } 
     160 
    170161        /*************Brotecs:add this********************** 
    171162        public void setIsUseTemplate(boolean isUse)