Page 1 of 1

Drawing lines between gaps in series data

Posted: Fri May 13, 2005 12:26 am
by 9341552
Hello All,

I am new to charting so please forgive me if this is an obvious question. I have a case where I need to do two line series in the same chart. I have a line of base data that has values by and for every date. I need to do another line series that does not have values for every date. I want each of the points on the second series to connect, skipping the dates without data where they exist. Is there a way to accomplish this?


Thanks,
-S

Posted: Fri May 13, 2005 8:12 am
by narcis
Hello sigipa,

Yes, you can add values to the series that doesn't have a value for every date using AddXY method and just skipping those non-existing values. Have a look at the code below, this snippet will add 11 values to Series1 and will only add a value to Series2 when i mod 2 = 0.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Randomize;

  for i:=0 to 10 do
  begin
    Series1.AddXY(i,random(100));
    if i mod 2 = 0 then
      Series2.AddXY(i,random(100));
  end;
end;