Hi Alain,

I'm new with TeeChart so I'm looking for help with the histogram. I managed to create a histogram with equal width binning but I also need to create a histogram with equal height binning and I don't know how. I'd like to do something like this:

http://www.saedsayad.com/unsupervised_binning.htm
I just don't know how to change the width of the bins with either HistogramSeries or AreaSeries.

If I understand it correctly, these the "width" in the "equal width binning" means the number of bars to be drawn, and the "height" in the "equal height binning" means the value for all the bars.

Then, I'm still not sure to understand how to calculate the "k" from the link you've posted. However, this example (where I hardcode the "k" but I calculate the rest) seems to work fine for me here:

```
uses Series, Math;
```**const**
Values : array[0..8] of **double** = (0, 4, 12, 16, 16, 18, 24, 26, 28);
procedure TForm1.FormCreate(Sender: TObject);
procedure FindMinMax(Arr: array of Double; var AMin, AMax: Double);
var
i: Integer;
begin
AMin:=Arr[Low(Arr)];
AMax:=Arr[Low(Arr)];
**for** i:=1 to High(Arr) **do**
begin
**if** Arr[i]>AMax then AMax:=Arr[i];
**if** Arr[i]<AMin then AMin:=Arr[i];
end;
end;
procedure AddEqWidthBin;
var k: Integer;
w: **double**;
tmpMin, tmpMax: Double;
EqWidthBin: TBarSeries;
i, j, cnt: Integer;
begin
EqWidthBin:=Chart1.AddSeries(TBarSeries) as TBarSeries;
FindMinMax(Values, tmpMin, tmpMax);
k:=3;
w:=(tmpMax-tmpMin)/k;
**for** i:=1 to k **do**
begin
cnt:=0;
**for** j:=Low(Values) to High(Values) **do**
begin
**if** ((i=1) and (Values[j]<tmpMin+w)) or
((i=k) and (Values[j]>=tmpMin+(k-1)*w)) or
((i>1) and (i<k) and (Values[j]>=tmpMin+(i-1)*w) and (Values[j]<tmpMin+i*w)) then
Inc(cnt);
end;
EqWidthBin.Add(cnt);
end;
end;
begin
Chart1.View3D:=**false**;
Chart1.Legend.Visible:=**false**;
Chart1.Title.Text.Text:='Equal width';
AddEqWidthBin;
end;

Understanding the example above, I think you shouldn't find problems to do a similar thing for the "equal height binning".

--

Best Regards

Yeray Alonso

Steema Support Central

Follow us in

Twitter and

Facebook
"Important note: If you are a TeeChart registered customer,

please post your support questions at Steema's Support

monitored Forums for a prompter reply."

http://support.steema.com
Connect with Us