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

  1. ==========================================================
  2.                TeeChart Pro 4.0
  3.       Copyright 1995-1998 by David Berneda. 
  4.              All Rights Reserved.
  5. ==========================================================
  6.  
  7.  
  8.  Saving and Loading Charts / URL Downloading
  9. =============================================
  10.  
  11. 1 -- Introduction
  12. 2 -- How it works ?
  13. 3 -- Routines
  14. 4 -- Testing
  15.  
  16. ---------------------------------------------
  17.  
  18. 1 -- Introduction
  19.  
  20. The example project TEESAVIN.DPR shows you how to
  21. store and reload Chart components, with all Chart and
  22. Series properties and will all Series point values.
  23.  
  24. This demo is a small "Chart Designer" application.
  25.  
  26.  
  27. 2 -- How it works ?
  28.  
  29. The TEESTORE.PAS unit (included in TeeChart-Pro), 
  30. contains the necessary routines to save and load Charts
  31. to files and to standard Delphi streams.
  32.  
  33. This unit basically calls the Delphi "WriteComponent" 
  34. method to store all Chart and Series properties, and then,
  35. for each Series in the Chart, it writes all Series point
  36. values.
  37.  
  38.  
  39. 3 -- Routines
  40. --------------------
  41.  
  42. The included methods in TeeStore.pas unit are:
  43.  
  44. { Read a Chart from a file ( Chart1,'c:\demo.tee' ) }
  45. Procedure LoadChartFromFile(Var AChart:TCustomChart; Const AName:String);
  46.  
  47. { Write a Chart to a file ( Chart1,'c:\demo.tee' ) }
  48. Procedure SaveChartToFile(AChart:TCustomChart; Const AName:String);
  49.  
  50. { The same using TStream components (good for BLOB fields, etc)  }
  51. Procedure LoadChartFromStream(Var AChart:TCustomChart; AStream:TStream);
  52. Procedure SaveChartToStream(AChart:TCustomChart; AStream:TStream);
  53.  
  54. { With an optional procedure pointer to catch loading errors }
  55. Procedure LoadChartFromStreamCheck( Var AChart:TCustomChart;
  56.                                     AStream:TStream;
  57.                                     ACheckError:TProcTeeCheckError
  58.                                );
  59.  
  60. { Same as above but using a file name }
  61. Procedure LoadChartFromFileCheck( Var AChart:TCustomChart;
  62.                                   Const AName:String;
  63.                                   ACheckError:TProcTeeCheckError
  64.                                   );
  65.  
  66. { Convert a *.tee file to readable ascii text format, 
  67.   without series point values (good for debugging or other apps) }
  68. Procedure ConvertTeeFileToText(Const InputFile,OutputFile:String);
  69.  
  70.  
  71. URL downloading
  72. ===================
  73.  
  74. The TeeURL.pas unit provides an additional method to download
  75. native *.tee chart files from remote Internet or Intranet URL
  76. addresses:
  77.  
  78. { Read a Chart from a file ( Chart1,'http://www.teemach.com/demo.tee' ) }
  79. Procedure LoadChartFromURL(Var AChart:TCustomChart; Const URL:String);
  80.  
  81.  
  82. 4 -- Testing
  83. ------------------
  84.  
  85. When you install TeeChart-Pro, you should see a new menu
  86. item on the right-click component menu at design-time.
  87.  
  88. This new menu item is "Save Chart..." and allows you to 
  89. create a *.TEE file and write the Chart into it.
  90.  
  91. Note: For DBCharts this option is disabled, as the DBChart
  92. will reload all points again from the databases.
  93.  
  94.  
  95. -- Saving 
  96. ----------------
  97.  
  98. The TEESAVIN.DPR project includes code to save and load charts.
  99. You can refer to this sources.
  100.  
  101.  
  102. Saving is very easy. You should only do the following:
  103.  
  104.  
  105.    SaveChartToFile( MyChart, 'c:\mychart.tee' );
  106.  
  107.  
  108. -- Loading
  109. -----------------
  110.  
  111. Loading Charts it's a little bit more difficult than saving
  112. them.
  113.  
  114. The following code does it:
  115.  
  116.  
  117. Var tmpChart : TCustomChart;
  118. Begin
  119.   Chart1.Free;
  120.   tmpChart:=TChart.Create(Self);
  121.   LoadChartFromfile(tmpChart,'c:\mychart.tee');
  122.   Chart1:=tmpChart as TChart;
  123.   Chart1.Parent:=Self;
  124. End;
  125.  
  126.  
  127. ---------------------------------------------------------------
  128.  
  129.