How to add NULL array to series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

How to add NULL array to series

Post by elmec » Wed May 07, 2014 4:13 am

Q1:We know that NULL values could be added to series by AddNull() function.
Is there a way to Add a null array to series, something like AddNullArray?

Q2: SetNull() function can be used to set specified point to NULL,
Is there a function to set all the point to NULL?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to add NULL array to series

Post by Yeray » Wed May 07, 2014 7:40 am

Hello,
elmec wrote:Q1:We know that NULL values could be added to series by AddNull() function.
Is there a way to Add a null array to series, something like AddNullArray?
AddArray function just loops into the given array and calls the Add() function. If you want an addNullArray, you could create it yourself. Ie:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmpVal: array of double;
begin
  SetLength(tmpVal, 20);
  for i:=Low(tmpVal) to High(tmpVal) do
    tmpVal[i]:=50+random*100;

  Chart1.AddSeries(TPointSeries);

  AddArrayNull(Chart1[0], tmpVal);
end;

function TForm1.AddArrayNull(const Series: TChartSeries; const Values:array of TChartValue):Integer;
var t : Integer;
begin
  with Series do
  begin
    BeginUpdate;
    try
      result:=High(Values)-Low(Values)+1;
      for t:=Low(Values) to High(Values) do
        SetNull(Add(Values[t]));
    finally
      EndUpdate;
    end;
  end;
end;
elmec wrote:Q2: SetNull() function can be used to set specified point to NULL,
Is there a function to set all the point to NULL?
As above, you'll have to loop your array of points. Ie:

Code: Select all

  for i:=0 to Count-1 do
    SetNull(i);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply