The problem is that the BarSeries are well drawn, but some entries in the Marks.Positions-List are null. Then it crashes.
What is the problem?
Creating the series
Code: Select all
procedure TForm1.Button3Click(Sender: TObject);
var i, val : integer
begin
for i := 0 to 30 do
begin
val := random(50)+50;
chart1.Series[0].AddXY(i+1, val, format('Mark: %d', [i+1]), clGreen);
val := random(50)+50;
chart1.Series[1].AddXY(i+1, val, format('Mark: %d', [i+1]), clRed);
dt := dt + 1;
end;
Chart1.Draw();
PlaceMarks();
end;
Code: Select all
procedure TForm1.PlaceMarks2;
var s, i, w1, w2, w3, tmpSize: Integer;
begin
Chart1.Draw;
for s:=0 to Chart1.SeriesCount-1 do
if Chart1[s] is TBarSeries then
with Chart1[s] as TBarSeries do
begin
for i:=0 to Count-1 do
with Marks.Positions[i] do
begin
if (marks.Visible = true) then
begin
Custom:=true; // => Exception !!!! (Marks.Position[i] is null)
Marks.Angle := 90;
LeftTop.X := LeftTop.X;
end;
end;
end;
end;