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

  1. {****************************************}
  2. {    TeeChart. TChart Component          }
  3. { Copyright (c) 1995-98 by David Berneda }
  4. {    All Rights Reserved                 }
  5. {****************************************}
  6. unit ULogLa;
  7.  
  8. interface
  9.  
  10. uses
  11.   WinProcs,WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  12.   TeEngine, Series, TeeProcs, Chart, StdCtrls, ExtCtrls;
  13.  
  14. type
  15.   TLogLabelsForm = class(TForm)
  16.     Panel1: TPanel;
  17.     Memo1: TMemo;
  18.     Button1: TButton;
  19.     CheckBox1: TCheckBox;
  20.     CheckBox3: TCheckBox;
  21.     Chart1: TChart;
  22.     Series1: TAreaSeries;
  23.     CheckBox2: TCheckBox;
  24.     procedure Button1Click(Sender: TObject);
  25.     procedure CheckBox3Click(Sender: TObject);
  26.     procedure CheckBox1Click(Sender: TObject);
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure CheckBox2Click(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34.  
  35. implementation
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TLogLabelsForm.Button1Click(Sender: TObject);
  40. begin
  41.   Close;
  42. end;
  43.  
  44. procedure TLogLabelsForm.CheckBox3Click(Sender: TObject);
  45. begin
  46.   Series1.GetHorizAxis.Logarithmic:=CheckBox3.Checked;
  47. end;
  48.  
  49. procedure TLogLabelsForm.CheckBox1Click(Sender: TObject);
  50. begin
  51.   Series1.GetVertAxis.Logarithmic:=CheckBox1.Checked;
  52. end;
  53.  
  54. procedure TLogLabelsForm.FormCreate(Sender: TObject);
  55. var t:Integer;
  56.     tmp:Double;
  57. begin
  58.   { add some positive sample random values, so we can see
  59.     good logarithmic labels... }
  60.   tmp:=Random(100);
  61.   Series1.Clear;
  62.   for t:=1 to 100 do
  63.   begin
  64.     tmp:=tmp+Abs(Random(10000)-5000);
  65.     Series1.AddXY(t*10,tmp,'',clTeeColor);
  66.   end;
  67. end;
  68.  
  69. procedure TLogLabelsForm.CheckBox2Click(Sender: TObject);
  70. begin
  71.   { change the axis labels format specifier string... }
  72.   if CheckBox2.Checked then
  73.   begin
  74.     Chart1.LeftAxis.AxisValuesFormat:='0E+';
  75.     Chart1.BottomAxis.AxisValuesFormat:='0E+';
  76.   end
  77.   else
  78.   begin
  79.     Chart1.LeftAxis.AxisValuesFormat:='#,##0.#############';
  80.     Chart1.BottomAxis.AxisValuesFormat:='#,##0.#############';
  81.   end;
  82. end;
  83.  
  84. end.
  85.