home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Delphi1_And_Delphi2 / EXAMPLES / EXTENDED / UDELPOIN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  1.5 KB  |  64 lines

  1. unit Udelpoin;
  2.  
  3. interface
  4.  
  5. { This example project shows how to delete points from
  6.   a Series.
  7.   After deleting points, you can optionally "compact"
  8.   the remaining points to "fill the gap" leaved by the
  9.   deleted points.
  10. }
  11. uses
  12.   Winprocs, Wintypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  13.   StdCtrls, Buttons, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
  14.  
  15. type
  16.   TDeletePointsForm = class(TForm)
  17.     Chart1: TChart;
  18.     BitBtn1: TBitBtn;
  19.     Button1: TButton;
  20.     Series1: TBarSeries;
  21.     Button2: TButton;
  22.     procedure BitBtn1Click(Sender: TObject);
  23.     procedure FormCreate(Sender: TObject);
  24.     procedure Button1Click(Sender: TObject);
  25.     procedure Button2Click(Sender: TObject);
  26.   private
  27.     { Private declarations }
  28.   public
  29.     { Public declarations }
  30.   end;
  31.  
  32. var
  33.   DeletePointsForm: TDeletePointsForm;
  34.  
  35. implementation
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TDeletePointsForm.BitBtn1Click(Sender: TObject);
  40. begin
  41.   if Series1.Count>3 then Series1.Delete(3);  { <-- delete the fourth point }
  42. end;
  43.  
  44. procedure TDeletePointsForm.FormCreate(Sender: TObject);
  45. begin
  46.   Series1.FillSampleValues(16);   { <-- random points }
  47. end;
  48.  
  49. procedure TDeletePointsForm.Button1Click(Sender: TObject);
  50. begin
  51.   Close;
  52. end;
  53.  
  54. procedure TDeletePointsForm.Button2Click(Sender: TObject);
  55. begin
  56.   Series1.XValues.FillSequence;  { <-- compact space }
  57.   Series1.Repaint;
  58.  
  59.  { Note: For Horizontal Bar Series, you should call
  60.          Series1.YValues.FillSequence instead of XValues. }
  61. end;
  62.  
  63. end.
  64.