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

  1. {**********************************************}
  2. {   TErrorBarSeries Component Example          }
  3. {   Copyright (c) 1995-1998 by David Berneda   }
  4. {**********************************************}
  5. {$P-}  { <-- this is very, very important }
  6. unit Uerrorba;
  7.  
  8. interface
  9.  
  10. uses
  11.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  12.   Forms, Dialogs, Teengine, Series, Errorbar, ExtCtrls, Chart, StdCtrls,
  13.   Buttons, TeeProcs;
  14.  
  15. type
  16.   TErrorBarForm = class(TForm)
  17.     Chart1: TChart;
  18.     ErrorBarSeries1: TErrorBarSeries;
  19.     Panel1: TPanel;
  20.     CheckBox1: TCheckBox;
  21.     Label1: TLabel;
  22.     BitBtn3: TBitBtn;
  23.     Memo1: TMemo;
  24.     procedure FormCreate(Sender: TObject);
  25.     procedure CheckBox1Click(Sender: TObject);
  26.     procedure Chart1GetLegendText(Sender: TCustomAxisPanel;
  27.       LegendStyle: TLegendStyle; Index: Longint;
  28.       var LegendText: String);
  29.     procedure Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  30.       Y: Integer);
  31.     procedure BitBtn3Click(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37.  
  38. implementation
  39.  
  40. {$R *.DFM}
  41. procedure TErrorBarForm.FormCreate(Sender: TObject);
  42. begin
  43.   ErrorBarSeries1.FillSampleValues(18);
  44.   Label1.Caption:='';
  45. end;
  46.  
  47. procedure TErrorBarForm.CheckBox1Click(Sender: TObject);
  48. begin
  49.   Chart1.View3D:=CheckBox1.Checked;
  50. end;
  51.  
  52. procedure TErrorBarForm.Chart1GetLegendText(Sender: TCustomAxisPanel;
  53.   LegendStyle: TLegendStyle; Index: Longint; var LegendText: String);
  54. begin
  55.   if LegendStyle=lsValues then
  56.   LegendText:=LegendText+' '+
  57.               FormatFloat('0.00',ErrorBarSeries1.ErrorValue[Index]);
  58. end;
  59.  
  60. procedure TErrorBarForm.Chart1MouseMove(Sender: TObject;
  61.   Shift: TShiftState; X, Y: Integer);
  62. var tmp:Longint;
  63. begin
  64.   tmp:=ErrorBarSeries1.Clicked(x,y);
  65.   if tmp<>-1 then
  66.     Label1.Caption:='Error Bar: '+FormatFloat('0.00',ErrorBarSeries1.ErrorValue[tmp])
  67.   else
  68.     Label1.Caption:='';
  69. end;
  70.  
  71. procedure TErrorBarForm.BitBtn3Click(Sender: TObject);
  72. begin
  73.   Close;
  74. end;
  75.  
  76. end.
  77.