Histograms

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
glazer
Newbie
Newbie
Posts: 10
Joined: Tue Nov 13, 2007 12:00 am

Histograms

Post by glazer » 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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 12, 2008 8:15 am

Hi glazer,

You shouldn't add data to Series2, this is the function series and TeeChart will use it to automatically calculate and plot the required function. I recommend you to read Tutorial 7 - Working with Functions. Tutorials can be found at TeeChart's program group.

If this doesn't help don't hesitate to let us know.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

glazer
Newbie
Newbie
Posts: 10
Joined: Tue Nov 13, 2007 12:00 am

Histograms

Post by glazer » Mon May 12, 2008 9:41 am

Thanks. Yes it was an elementary mistake. Problem is now solved. Many thanks

Post Reply