How to detect if YValue is NUL ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

How to detect if YValue is NUL ?

Post by moelski » Tue Feb 05, 2008 2:50 pm

Hi support,

I use this procedure to delete data from my chart:

Code: Select all

      for i := MainChart[0].Count-1 downto 0 do
      begin
        tmp := MainChart[0].XValue[i];

        if ((tmp >= Tool.StartValue) and (tmp <= Tool.EndValue)) then
        begin
          for j := 0 to MainChart.SeriesCount - 1 do
              MainChart[j].Delete(i);
        end;
      end;
      for j := 0 to MainChart.SeriesCount - 1 do
        MainChart[j].XValues.FillSequence;
For selecting I use a TColorBandTool.

This works fine. But no I got a problem with an empty series. Lets say you have 3 FastLineSeries. Series 1 and 2 are filled with Samplevalues and series 3 contains no data. It is empty.

Now you run the code and got an error in this line:
MainChart[j].Delete(i);

The problem is that there is nothing to delete. So how can I check if MainChart[j].YValue is an empty data field?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 05, 2008 3:21 pm

Hi Dominik,

You could try something like this:

Code: Select all

  if Series1.Count>0 then
    Series1.Delete(i);
or this:

Code: Select all

  if Series1.YValues.Count>0 then
    Series1.Delete(i);
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Tue Feb 05, 2008 3:24 pm

Thx Narcis,

that´s the way I found some seconds ago ... :roll:

It works. Thx !

Post Reply