Changeset 1501
- Timestamp:
- 11/30/08 08:26:56 (5 weeks ago)
- Location:
- branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart
- Files:
-
- 4 modified
-
CurrentTemplate.java (modified) (3 diffs)
-
IGraphTemplate.java (modified) (2 diffs)
-
LineChart.java (modified) (8 diffs)
-
WHOWeightTemplate.java (modified) (6 diffs)
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 2 2 3 3 import java.util.Vector; 4 5 import org.javarosa.patient.model.Patient; 4 6 5 7 /* … … 12 14 public static final String CURRENT_TEMPLATE_NAME = "CurrentGraph"; 13 15 public static boolean isUseTemplate=false; //brotecs:add this 14 16 private Patient patient; 15 17 /* 16 18 * (non-Javadoc) … … 58 60 return isUseTemplate; 59 61 } 62 63 public Patient getPatient() { 64 return this.patient; 65 } 60 66 } -
branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/IGraphTemplate.java
r1452 r1501 2 2 3 3 import java.util.Vector; 4 5 import org.javarosa.patient.model.Patient; 4 6 5 7 public interface IGraphTemplate { … … 25 27 */ 26 28 Vector getLines(Vector data,LineChart chart); 29 public Patient getPatient(); 27 30 //public void setIsUseTemplate(boolean isUseTemplate); 28 31 //public boolean getIsUseTemplate(); -
branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/LineChart.java
r1452 r1501 82 82 templatemarginOne=36;//brotecs 83 83 templatexScaleFactor=13;//brotecs 84 // System.out.println("Brotecs::LineChart->LineChart(String label, Style style)");85 84 } 86 85 … … 160 159 g1.setColor(0, 0, 0); 161 160 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));163 161 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));165 162 166 163 } … … 252 249 int l = this.width - marginOne; 253 250 int i1 = this.height - fontSpaceHeight; 254 //System.out.println("Brotecs::LineChart->this.width ==> " + this.width + " this.height == " + this.height + " l = " + l + " i1 == " + i1);255 251 g.setFont(font); 256 252 g.setColor(255, 255, 255); … … 302 298 for(int i = 0; i <= height; i += 10) { 303 299 int j1 = this.height - fontSpaceHeight - i; 304 //System.out.println("Brotecs::LineChart->marginOne:"+marginOne+"j1:"+j1+"marginOne-2"+(marginOne-2));305 300 g.drawLine(marginOne, j1, marginOne - 2, j1); //draw Y axis "-" 306 301 int point = (yScaleFactor * i) / height; 307 //System.out.println("Brotecs::LineChart->drawChart:"+point+"="+yScaleFactor+"*"+i+"/"+height);308 302 pointLabelWidth = font.stringWidth(String.valueOf(point)); 309 303 … … 325 319 326 320 public void drawLine(Graphics g, Vector pointVector) { 327 //System.out.println("Brotecs::LineChart->drawLine:pointVector.size()="+pointVector.size());328 321 pointVector.size(); 329 322 int count = -1; … … 357 350 int pointY2 = this.height - fontSpaceHeight - (height * b1.yCordPt) / (yScaleFactor); 358 351 359 //System.out.println("Brotecs::pointY2->this.height:"+this.height +"- fontSpaceHeight:"+fontSpaceHeight+" - (height:"+height+" * b1.yCordPt:" + b1.yCordPt + ") / yScaleFactor:"+yScaleFactor);360 352 //int pointX2 = marginOne + (width * b1.xCordPt) / (xScaleFactor * scaleFactor); 361 353 /************Brotecs*************/ 362 354 int pointX2; 363 if(defaulttemplate){ //364 pointX2 = marginOne + (width * b1.xCordPt) / (templatexScaleFactor * scaleFactor);355 if(defaulttemplate){ 356 pointX2 = marginOne + (width * b1.xCordPt) / (templatexScaleFactor * 6); 365 357 } 366 358 else … … 369 361 } 370 362 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*************/ 375 364 if(count > -1) { 376 365 g.drawLine(pointX1, pointY1, pointX2, pointY2); 377 //System.out.println("Brotecs::LineChart->pointX1:"+pointX1+" pointY1:"+pointY1+" pointX2:"+pointX2+" pointY2:"+pointY2);378 366 } 379 367 pointX1 = pointX2; … … 390 378 else{ 391 379 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); 394 381 } 395 382 pointLabelWidth = font.stringWidth(b1.labelX); 396 383 if(isLabelXTrue && (count + 1) % (equalCoordTicker * ticker) == 0) { 397 384 //g.drawString(b1.labelX, pointX2 - pointLabelWidth / 2, (this.height - fontSpaceHeight) + 1, 20); 398 399 385 } 400 386 } -
branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/chart/WHOWeightTemplate.java
r1452 r1501 25 25 public static boolean isUseTemplate=false; //brotecs:add this 26 26 private Patient patient; 27 27 public int age; 28 28 /* 29 29 * (non-Javadoc) … … 55 55 Vector points2 = new Vector(); 56 56 Vector points3 = new Vector(); 57 58 57 lines.addElement(points1);/*Brotecs*/ 59 58 lines.addElement(points3);/*Brotecs*/ 60 59 lines.addElement(points2); 61 62 63 64 60 Date birthdate=patient.getBirthDate(); 65 66 61 Date today=new Date(); 67 62 Calendar calendar = Calendar.getInstance(); 68 63 calendar.setTime(today); 69 64 int thisYear = calendar.get(Calendar.YEAR); 70 System.out.println("towhid::::WHOWeightTemplate:thisYear="+thisYear);71 65 calendar.setTime(birthdate); 72 66 int birthYear = calendar.get(Calendar.YEAR); 73 System.out.println("towhid::::WHOWeightTemplate:birthYear="+birthYear);74 75 67 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){ 78 70 if(patient.getGender()==patient.SEX_MALE){ 79 71 … … 87 79 int [] chartY3PointsArray = {0, 2, 4, 11, 20, 26, 34, 42, 58}; 88 80 89 System.out.println("towhid::::WHOWeightTemplate:Gender=MALE");81 //System.out.println("towhid::::WHOWeightTemplate:Gender=MALE"); 90 82 for(int i = 0; i < chartX2PointsArray.length; i++) { 91 83 points2.addElement(new LinePointsItem("", chartX2PointsArray[i], chartY2PointsArray[i], 0, 255, 255)); … … 107 99 int [] chartY1PointsArray = {4, 6, 9, 12, 13, 14, 19, 22, 25}; 108 100 int [] chartX1PointsArray = {0, 1, 5, 14, 16, 19, 39, 50, 60}; 109 110 101 int [] chartY2PointsArray = {3, 5, 7, 9, 11, 13, 15, 17, 18}; 111 102 int [] chartX2PointsArray = {0, 2, 5, 12, 20, 31, 42, 55, 59}; 112 113 103 int [] chartY3PointsArray = {2, 4, 5, 7, 8, 9, 10, 13, 14}; 114 104 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"); 117 106 for(int i = 0; i < chartX3PointsArray.length; i++) { 118 107 points3.addElement(new LinePointsItem("", chartY3PointsArray[i], chartX3PointsArray[i], 0, 255, 255)); … … 132 121 int [] chartX1PointsArray = {5, 6, 8, 12, 13, 15, 17, 19, 23}; 133 122 int [] chartY1PointsArray = {0, 1, 2, 12, 16, 23, 31, 39, 60}; 134 135 123 int [] chartX2PointsArray = {3, 5, 9, 10, 11, 13, 15, 17, 18}; 136 124 int [] chartY2PointsArray = {0, 2, 10, 14, 18, 28, 40, 52, 56}; 137 138 125 int [] chartX3PointsArray = {2, 4, 5, 8, 9, 10, 11, 12, 14}; 139 126 int [] chartY3PointsArray = {0, 2, 4, 11, 20, 26, 34, 42, 58}; … … 168 155 this.patient = patient; 169 156 } 157 public Patient getPatient() { 158 return this.patient; 159 } 160 170 161 /*************Brotecs:add this********************** 171 162 public void setIsUseTemplate(boolean isUse)
