home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Delphi1_And_Delphi2 / EXAMPLES / OTHER / MONTHLY / README.TXT < prev    next >
Encoding:
Text File  |  1998-10-24  |  2.5 KB  |  92 lines

  1. ==========================================================
  2.                TeeChart Pro 4.0
  3.       Copyright 1995-1998 by David Berneda. 
  4.              All Rights Reserved.
  5.  
  6. teeMach, SL
  7. PO Box 22262, Barcelona 08080, Catalonia, Spain.
  8. ==========================================================
  9.  
  10.  
  11.  Charting Monthly and Weekly data
  12. =============================================
  13.  
  14. 1 -- Introduction
  15. 2 -- How it works ?
  16. 3 -- Testing 
  17.  
  18.  
  19. 1 -- Introduction
  20. --------------------
  21.  
  22. The included TEEMONTH.PAS unit contains one useful 
  23. routine to create Series showing data grouped by
  24. Month, or by Week in the year.
  25.  
  26. This routine is called:
  27.  
  28. DBMonthlySeries
  29.  
  30. And the declaration and parameters are:
  31.  
  32.  
  33. procedure DBMonthlySeries( ASeries:TChartSeries;
  34.                            ATable:TDataSet;
  35.                            Const DateFieldName,
  36.                                  ValueFieldName:String;
  37.                            DatePeriod:TDateTimeStep;
  38.                            Count:Boolean);
  39.  
  40.  
  41. Parameter       Description
  42. ============    ============================================
  43. ASeries         The Series you want to fill with points.
  44. ATable          The Table (or Query) where you have the data.
  45. DateFieldName   The field name in the Table with Dates.
  46. ValueFieldName  The field name in the Table with Values.
  47. DatePeriod      possible values:   dtMonth or dtWeek
  48. Count           Set to False if you want to Sum, or True to Count.
  49.  
  50. ============    ============================================
  51.  
  52.  
  53. 2 -- How it works ?
  54. --------------------
  55.  
  56. When you call this routine, the following things happen:
  57.  
  58. a) The current Series points are deleted ( Series1.Clear )
  59.  
  60. b) The Table or Query is traversed completely.
  61.    ( All records are loaded in a loop )
  62.  
  63. c) For each record, a small algorithm determines to which
  64.    MONTH, or to which WEEK the record belongs.
  65.  
  66.    This is done using the "DateFieldName" field.
  67.  
  68. d) The "Value" field is used to accumulate the value 
  69.    corresponding to the MONTH or WEEK.
  70.  
  71.    ( The value is summed or incremented depending on "Count" 
  72.      parameter )
  73.  
  74.  
  75. The final result is a Series containing one point for each
  76. MONTH or WEEK existing in the Table.
  77.  
  78. The value of every point corresponds to the sum or count of
  79. records for that MONTH or WEEK.
  80.  
  81.  
  82. 3 -- Testing 
  83. -----------------
  84.  
  85. Open and run the included MONTHLY.DPR example to see how
  86. it works.
  87.  
  88. Follow the example unit source code comments to understand
  89. how it is done.
  90.  
  91. --------------------------------------------------------------
  92.