Histograms
Posted: Sat May 10, 2008 2:05 pm
I am trying to create a histogram from a set of data but I cant seem to get it to work. I have typically about 1000 floating point numbers in the array MyLog which is declared in another unit (unit1). The following is sample code: The line
Series2.FunctionType:= TeeFunction1;
cause the program to hang up. I obviously dont understand something about how to make histograms and plot from a simple array.
unit Histogram;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeCanvas,ExtCtrls, TeeProcs, TeEngine, Chart,TeeHistogram,
Series, StatChar, ComCtrls, TeeEdit,QDialogs;
type
THistogramFunctionForm = class(TForm)
Chart1: TChart;
Series2: THistogramSeries;
StatusBar1: TStatusBar;
ChartEditor1: TChartEditor;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
HistogramFunctionForm: THistogramFunctionForm;
implementation
uses Unit1;
{$R *.dfm}
procedure THistogramFunctionForm.FormActivate(Sender: TObject);
var i,j: integer;
TeeFunction1 : THistogramFunction;
begin
TeeFunction1.NumBins := 20;
TeeFunction1.Cumulative := False;
Series2.Clear;
for i:=1 to Engine.Num do
Series2.Add(MyLog,'');
Series2.FunctionType:= TeeFunction1;
end;
end.
Series2.FunctionType:= TeeFunction1;
cause the program to hang up. I obviously dont understand something about how to make histograms and plot from a simple array.
unit Histogram;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeCanvas,ExtCtrls, TeeProcs, TeEngine, Chart,TeeHistogram,
Series, StatChar, ComCtrls, TeeEdit,QDialogs;
type
THistogramFunctionForm = class(TForm)
Chart1: TChart;
Series2: THistogramSeries;
StatusBar1: TStatusBar;
ChartEditor1: TChartEditor;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
HistogramFunctionForm: THistogramFunctionForm;
implementation
uses Unit1;
{$R *.dfm}
procedure THistogramFunctionForm.FormActivate(Sender: TObject);
var i,j: integer;
TeeFunction1 : THistogramFunction;
begin
TeeFunction1.NumBins := 20;
TeeFunction1.Cumulative := False;
Series2.Clear;
for i:=1 to Engine.Num do
Series2.Add(MyLog,'');
Series2.FunctionType:= TeeFunction1;
end;
end.