TreatNulls during runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
daniele_h
Newbie
Newbie
Posts: 13
Joined: Thu Jan 31, 2008 12:00 am

TreatNulls during runtime

Post by daniele_h » Thu Mar 11, 2010 12:42 pm

Dear All

I use following code to create a line out of a database @ runtime. Unfortunately the property of interest "TreatNulls " is not applied.
In the ChartEditor, the property is set to what's been coded, but the line itself is not *affected*!
-> (speak, the line is drawn in any case in "tnIgnore" mode )
I did try to place the TreatNull code-line at different places, but without success.

can you advise me what am I doing wrong or how it can be corrected?

Code: Select all

   fs := TFastLineSeries.Create(Self);
    with fs do
    begin
      ParentChart := ch;
      XValues.Order := loNone;
      XValues.DateTime:= True;
      TreatNulls  := tnSkip; // tnDontPaint, tnSkip, tnIgnore   <-- is not "accepted"
      AutoRepaint := False;
      LinePen.OwnerCriticalSection := nil;
      FastPen := True;
      Stairs  := True;
      Title   := 'Test';

      DataSource := PCmain.D_DATA;
      XValues.ValueSource:= 'COL_0';
      YValues.ValueSource:= 'COL_4';

      CheckDatasource;
      Repaint;
    end;
Regards
Daniele

Using TeeChart8.06Delphi2009

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

Re: TreatNulls during runtime

Post by Yeray » Thu Mar 11, 2010 2:45 pm

Hi Daniele,

Adding your values from a database you still need to mark those which you want to be null looping into your data and using series' SetNull method or changing the point's color to clNone.
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

daniele_h
Newbie
Newbie
Posts: 13
Joined: Thu Jan 31, 2008 12:00 am

Re: TreatNulls during runtime

Post by daniele_h » Thu Mar 11, 2010 3:11 pm

Hi Yeray,
Sorry, you misunderstand. I don't "want" any value to be Null, but it just happans that values in the database are missing altogether.
Fact is that if you use the ChartEditor and go to series -> Treat Nulls and set "Skip" then the line is displayed without a gap (ie. the gaps are bridged) - which is what I like. and which I should be able to achieve by code.

If you set "Ignore" then the missing values (nils) are treated as zero (- a mathematical no-go !! ;-).
The other - even more correct - behaviour is with "Don't paint", in that case the line is interrupted, but for my purpose less optimal.

I'd like to set "Skip" from the beginning (by the code), but when run, it does not display as "Sikp", but as "Ignore".

I tried to put the line "TreatNulls := tnSkip;" after CheckDatasource but to no avail.

regards
Daniele

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

Re: TreatNulls during runtime

Post by Yeray » Thu Mar 11, 2010 3:44 pm

Hi Daniele,

Excuse me, it seems I didn't understand you well.
So setting treatnulls as tnSkip through the editor it works fine but not at runtime, right?
Here I've tried the following (your code with some data) and it seems to work fine here. Could you please try it in a new simple application and see if the problem persists for you?

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
var fs: TFastLineSeries;
begin
  Chart1.View3D:=false;

  fs := TFastLineSeries.Create(Self);
  with fs do
  begin
    ParentChart := chart1;
    XValues.Order := loNone;
    XValues.DateTime:= True;
    TreatNulls  := tnSkip; // tnDontPaint, tnSkip, tnIgnore   <-- is not "accepted"
    AutoRepaint := False;
    LinePen.OwnerCriticalSection := nil;
    FastPen := True;
    Stairs  := True;
    Title   := 'Test';

    Add(20);
    Add(0);
    Add(10);
    AddNull(5);
    Add(10);
    Add(5);
  end;
end;
If this works as expected, there should be some property in your project that we are missing. So, please try to arrange an as simple as possible project we can run as-is to reproduce the problem here and we will take a look a it.
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

daniele_h
Newbie
Newbie
Posts: 13
Joined: Thu Jan 31, 2008 12:00 am

Re: TreatNulls during runtime

Post by daniele_h » Thu Mar 11, 2010 4:47 pm

Dear Yeray,

The problem persists with a newly created project with the code from you last post.
I upload the project.
Notice that the charteditor displays the correct setting as has been coded, but by selecting "don't paint" and re-selecting Skip, the line is displayed correctly.

regards
Daniele
Attachments
testTreatNull.7z
(110.93 KiB) Downloaded 448 times

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

Re: TreatNulls during runtime

Post by Yeray » Fri Mar 12, 2010 4:13 pm

Hi Daniele,

I've seen that this was a bug identified on 13th November 2009 in TeeChart v8.06 (TV52014561). And I've also seen that this was fixed on 3rd February 2010 so it should be available with the next maintenance release.
Also note that setting IgnoreNulls:=False should work around this in 8.06.
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

daniele_h
Newbie
Newbie
Posts: 13
Joined: Thu Jan 31, 2008 12:00 am

Re: TreatNulls during runtime

Post by daniele_h » Fri Mar 12, 2010 8:03 pm

Thank you Yeray,
appreciate your workaround

regards
daniele

Post Reply