D6 Making Chart Series Dynamic - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

D6 Making Chart Series Dynamic

Ok so I have this procedure that creates series for my chart at runtime, it works fine, the first time. While the program is running I have to at one point when the user clicks an icon, I have to cycle through the series to see which ones of my box items are there and if X is not there create a new series. It doesn't work needless to say the second time, I get an error on run.

This is my procedure:

[code]
procedure createSeries ();
var
account: string;
autoP: bool;
I: integer;
Line: TLineSeries;
begin
Form1.Chart1.RemoveAllSeries;

for I := 0 to Form1.servlist.Items.Count-1 do
begin

account := Form1.servlist.Items.Strings[I];
autoP := readBoolFromRegistry('Softwaremf' + account, 'wping', false);

if autoP = true then
begin

Line := TLineSeries.Create(Line);
Line.Title := account;
Line.Name := account;
Line.Marks.Visible := true;
Line.Marks.Clip := false;

If Form1.Chart1.SeriesList.IndexOf(Line.Pointer) = -1 then
begin
Form1.Chart1.AddSeries(Line);
end;

end;

end;

end;
[/code]

It all works perfect the first time, but the second time it says that line component already exists.

Comments

Sign In or Register to comment.