home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Map_Series.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  3.9 KB  |  120 lines

  1. unit Map_Series;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, TeEngine, TeeSurfa, TeeMapSeries, ExtCtrls, TeeProcs, Chart,
  8.   StdCtrls, ActnList, TeeChartActions;
  9.  
  10. type
  11.   TMapSeriesForm = class(TBaseForm)
  12.     Series1: TMapSeries;
  13.     Button1: TButton;
  14.     ActionList1: TActionList;
  15.     ChartActionEdit1: TChartActionEdit;
  16.     CheckBox1: TCheckBox;
  17.     ChartActionAxes1: TChartActionAxes;
  18.     SeriesActionMarks1: TSeriesActionMarks;
  19.     CheckBox2: TCheckBox;
  20.     CheckBox3: TCheckBox;
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure CheckBox3Click(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.     Procedure AddSampleShapes;
  26.   public
  27.     { Public declarations }
  28.   end;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33.  
  34. Procedure TMapSeriesForm.AddSampleShapes;
  35.  
  36.   Procedure AddShape(Const X,Y:Array of Integer; AColor:TColor; Const AText:String);
  37.   var t : Integer;
  38.   begin
  39.     With Series1.Shapes.Add do  { <-- add a new empty shape... }
  40.     begin
  41.       { add the XY coordinates }
  42.       for t:=Low(X) to High(X) do AddXY(X[t],Y[t]);
  43.       { the shape color... }
  44.       Color:=AColor;
  45.       { the shape text... }
  46.       Text:=AText;
  47.       { the shape Value (Z)... }
  48.       Z:=Random(1000)/1000.0;
  49.     end;
  50.   end;
  51.  
  52. Const AX:Array[0..13] of Integer=(1,3,4,4,5,5,6,6,4,3,2,1,2,2);
  53.       AY:Array[0..13] of Integer=(7,5,5,7,8,9,10,11,11,12,12,11,10,8);
  54.       BX:Array[0..8]  of Integer=(5,7,8,8,7,6,5,4,4);
  55.       BY:Array[0..8]  of Integer=(4,4,5,6,7,7,8,7,5);
  56.       CX:Array[0..15] of Integer=(9,10,11,11,12,9,8,7,6,6,5,5,6,7,8,8);
  57.       CY:Array[0..15] of Integer=(5,6,6,7,8,11,11,12,11,10,9,8,7,7,6,5);
  58.       DX:Array[0..7]  of Integer=(12,14,15,14,13,12,11,11);
  59.       DY:Array[0..7]  of Integer=(5,5,6,7,7,8,7,6);
  60.       EX:Array[0..10] of Integer=(4,6,7,7,6,6,5,4,3,3,2);
  61.       EY:Array[0..10] of Integer=(11,11,12,13,14,15,16,16,15,14,13);
  62.       FX:Array[0..11] of Integer=(7,8,9,11,10,8,7,6,5,5,6,6);
  63.       FY:Array[0..11] of Integer=(13,14,14,16,17,17,18,18,17,16,15,14);
  64.       GX:Array[0..11] of Integer=(10,12,12,14,13,11,9,8,7,7,8,9);
  65.       GY:Array[0..11] of Integer=(10,12,13,15,16,16,14,14,13,12,11,11);
  66.       HX:Array[0..9]  of Integer=(17,19,18,18,17,15,14,13,15,16);
  67.       HY:Array[0..9]  of Integer=(11,13,14,16,17,15,15,14,12,12);
  68.       IX:Array[0..14] of Integer=(15,16,17,16,15,14,14,13,12,11,10,11,12,13,14);
  69.       IY:Array[0..14] of Integer=(6,6,7,8,8,9,10,11,12,11,10,9,8,7,7);
  70.       JX:Array[0..11] of Integer=(15,16,16,17,17,16,15,13,12,12,14,14);
  71.       JY:Array[0..11] of Integer=(8,8,9,10,11,12,12,14,13,12,10,9);
  72.       KX:Array[0..9]  of Integer=(17,19,20,20,19,17,16,16,17,16);
  73.       KY:Array[0..9]  of Integer=(5,5,6,8,8,10,9,8,7,6);
  74.       LX:Array[0..6]  of Integer=(19,20,21,21,19,17,17);
  75.       LY:Array[0..6]  of Integer=(8,8,9,11,13,11,10);
  76. begin
  77.   AddShape(AX,AY,clLime,   'A');
  78.   AddShape(BX,BY,clRed,    'B');
  79.   AddShape(CX,CY,clFuchsia,'C');
  80.   AddShape(DX,DY,clAqua,   'D');
  81.   AddShape(EX,EY,clSilver, 'E');
  82.   AddShape(FX,FY,clAqua,   'F');
  83.   AddShape(GX,GY,clGreen,  'G');
  84.   AddShape(HX,HY,clTeal,   'H');
  85.   AddShape(IX,IY,clWhite,  'I');
  86.   AddShape(JX,JY,clRed,    'J');
  87.   AddShape(KX,KY,clBlue,   'K');
  88.   AddShape(LX,LY,clYellow, 'L');
  89. end;
  90.  
  91. procedure TMapSeriesForm.FormCreate(Sender: TObject);
  92. begin
  93.   inherited;
  94.   { Add some shapes... }
  95.   Series1.Clear;
  96.   AddSampleShapes;
  97.  
  98.   { Set the color palette "strong" }
  99.   Series1.PaletteStyle:=psStrong;
  100.  
  101.   { Marks... }
  102.   Series1.Marks.Bevel:=bvRaised;
  103.   Series1.Marks.Color:=clSilver;
  104. end;
  105.  
  106. procedure TMapSeriesForm.CheckBox3Click(Sender: TObject);
  107. begin
  108.   { change the color palette style... }
  109.   if CheckBox3.Checked then
  110.   begin
  111.     Series1.UsePalette:=True;
  112.     Series1.UseColorRange:=False;
  113.   end
  114.   else Series1.UseColorRange:=True;
  115. end;
  116.  
  117. initialization
  118.   RegisterClass(TMapSeriesForm);
  119. end.
  120.