The easiest option might be using new TErrorPointSeries which would handle this automatically. You can find examples at the What's New?\Welcome!\New Series\Error Point section in the new features demo, available at TeeChart's program group. Here you have an example:
uses TeeErrorPoint;
procedure TForm1.FormCreate(Sender: TObject);
var
i, j : Integer;
Series1 : TErrorPointSeries;
x, y : Double;
Top, Bottom : Double;
begin
Chart1.View3D:=False;
for i := 0 to 3 do
begin
Series1:=TErrorPointSeries.Create(Self);
Series1.Pen.Width:=3;
Chart1.AddSeries(Series1);
Randomize;
for j := 0 to 10 do
begin
x:=j;
y:=Random(100);
Top:= Random(10);
Bottom:= Random(10);
Series1.Add(x,y,0,0,Top,Bottom);
end;
end;
end;
Also, we found an issue that, with big error values, vertical axes are not calculated correctly. We are investigating it but we found setting vertical axes offset solves the problem for example
Chart1.Axes.Left.MinimumOffset:=1;
Chart1.Axes.Left.MaximumOffset:=1;
Using your code I get this image:
I guess this is what you mean by "stacked". I thought the problem was series were overlapping, not stacking. Since TErrorPointSeries doesn't support stacking options as bar, area or line series do, you should populate TErrorPointSeries with slightly different X values to simulate this behaviour, for example:
for j := 0 to ncri -1 do
begin
x:=j + i*0.3; //Side by side offset.
y:=k[j,i];;
Top:= max[j,i]-k[j,i];
Bottom:= k[j,i]-min[j,i];
Series1.Add(x,y,0,0,Top,Bottom);
end;
Changing the code snippet above in your example produces this chart:
Which I guess it's something similar to what you were looking for.