Confused by Chart1[i] notation
Posted: Wed Oct 27, 2010 5:30 pm
Hi,
I'm reading through a code example provided by Yeray ยป 03 May 2007 08:44. Here's a piece of that code.
for i := 0 to nSeries-1 do
begin
Chart1.AddSeries(TLineSeries);
Chart1.CustomAxes.Add;
Chart1.CustomVertAxis := Chart1.CustomAxes.Items;
Chart1.CustomAxes.Items.Axis.Color := Chart1.Color;
Chart1.CustomAxes.Items.Grid.Visible := False;
ComboBox2.Items.Add('Series' + inttostr(i + 1));
Chart1.FillSampleValues(20000);
Chart1.CustomAxes.Items.PositionUnits := muPixels;
if ((i+1) mod 2 = 0) then
Chart1.CustomAxes.Items.OtherSide := True;
end;
I'm confused by the array index attached to some of the Chart1 references in that code. I'm clearly missing something because that notation doesn't make any sense to me. The notation Chart1 suggests there is an array of several charts, however, I'm reasonably sure the example was meant to apply to a single instance of a single TChart component. I haven't been able to find anything in the documentation that suggests why this notation is valid. Can you explain what Yeray is up to there?
Thanks!
Brian
I'm reading through a code example provided by Yeray ยป 03 May 2007 08:44. Here's a piece of that code.
for i := 0 to nSeries-1 do
begin
Chart1.AddSeries(TLineSeries);
Chart1.CustomAxes.Add;
Chart1.CustomVertAxis := Chart1.CustomAxes.Items;
Chart1.CustomAxes.Items.Axis.Color := Chart1.Color;
Chart1.CustomAxes.Items.Grid.Visible := False;
ComboBox2.Items.Add('Series' + inttostr(i + 1));
Chart1.FillSampleValues(20000);
Chart1.CustomAxes.Items.PositionUnits := muPixels;
if ((i+1) mod 2 = 0) then
Chart1.CustomAxes.Items.OtherSide := True;
end;
I'm confused by the array index attached to some of the Chart1 references in that code. I'm clearly missing something because that notation doesn't make any sense to me. The notation Chart1 suggests there is an array of several charts, however, I'm reasonably sure the example was meant to apply to a single instance of a single TChart component. I haven't been able to find anything in the documentation that suggests why this notation is valid. Can you explain what Yeray is up to there?
Thanks!
Brian