Page 1 of 1

How to detect if YValue is NUL ?

Posted: Tue Feb 05, 2008 2:50 pm
by 9349911
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?

Posted: Tue Feb 05, 2008 3:21 pm
by narcis
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!

Posted: Tue Feb 05, 2008 3:24 pm
by 9349911
Thx Narcis,

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

It works. Thx !