home *** CD-ROM | disk | FTP | other *** search
/ PC Expert 29 / Pce29cd.iso / RUNIMAGE / DELPHI40 / DEMOS / TEECHART / ULEGEND.PAS < prev    next >
Pascal/Delphi Source File  |  1998-06-16  |  2KB  |  63 lines

  1. {****************************************}
  2. {    TeeChart. Legend Example            }
  3. { Copyright (c) 1995,96 by David Berneda }
  4. {    All Rights Reserved                 }
  5. {****************************************}
  6. unit Ulegend;
  7.  
  8. interface
  9. { This form shows how to create a new Chart.Legend.
  10.   We'll draw the Series Titles onto a Paintbox component.
  11. }
  12. uses
  13.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  14.   Forms, Dialogs, ExtCtrls, Chart, Series, StdCtrls, Teengine, Buttons,
  15.   TeeProcs;
  16.  
  17. type
  18.   TLegendForm = class(TForm)
  19.     Chart1: TChart;
  20.     LineSeries1: TLineSeries;
  21.     LineSeries2: TLineSeries;
  22.     PaintBox1: TPaintBox;
  23.     Panel1: TPanel;
  24.     BitBtn3: TBitBtn;
  25.     Label1: TLabel;
  26.     Memo1: TMemo;
  27.     procedure LineSeries2AfterDrawValues(Sender: TObject);
  28.     procedure FormCreate(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34.  
  35. var
  36.   LegendForm: TLegendForm;
  37.  
  38. implementation
  39.  
  40. {$R *.DFM}
  41.  
  42. procedure TLegendForm.LineSeries2AfterDrawValues(Sender: TObject);
  43. var t:Longint;
  44. begin
  45.   With Paintbox1.Canvas do  { we'll draw over PaintBox1 }
  46.   Begin
  47.     for t:=0 to Chart1.SeriesCount-1 do  { for each Series in Chart... }
  48.     Begin
  49.       Font.Color:=Chart1[t].SeriesColor;  { set font color }
  50.       { draw the customized Series Title }
  51.       TextOut(40,20+16*t,'This is a long Series title: '+Chart1.SeriesTitleLegend(t));
  52.     end;
  53.   End;
  54. end;
  55.  
  56. procedure TLegendForm.FormCreate(Sender: TObject);
  57. begin
  58.   LineSeries1.FillSampleValues(50); { random values }
  59.   LineSeries2.FillSampleValues(50);
  60. end;
  61.  
  62. end.
  63.