TFastLineSeries displays null point

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
rhyden
Newbie
Newbie
Posts: 7
Joined: Wed Aug 18, 2004 4:00 am

TFastLineSeries displays null point

Post by rhyden » Tue Mar 13, 2007 11:07 pm

I am using VCL version 7.08 and Delphi 2006.

I need to be able to handle "bad" values in my graph by adding a null point. I can do this easily with a TLineSeries via the AddNullXY function. When I try to do this with a TFastLineSeries, a line is drawn to the point that I add with this function. I need to be able to make the fastline series behave like the line series when I add a nullxy point. Is there a property or something that I need to set in order to accomplish this?

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

Post by Yeray » Wed Mar 14, 2007 10:25 am

Hi rhyden,
you're right, this is a known issue in our wish-list to be enhanced for future releases. In the meantime, In order to do what you need, you can do something like the example bellow:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Series, TeEngine, ExtCtrls, TeeProcs, Chart;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    Series2: TFastLineSeries;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    LastNull: Boolean;
    procedure AddValue(Series: TFastLineSeries; X,Y: Double; IsNull: Boolean);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Series2.IgnoreNulls := False;
  LastNull:=false;

  for i := 0 to 10 do
  begin
   if ((i=2) or (i=5) or (i=6)) then
    begin
      Series1.AddNullXY(Series1.Count, Random(1000));
      AddValue(Series2, Series2.Count, Random(1000), true);
    end
    else
    begin
      Series1.AddXY(Series1.Count, Random(1000));
      AddValue(Series2, Series2.Count, Random(1000), false);
    end;
  end;

end;

procedure TForm1.AddValue(Series: TFastLineSeries; X,Y: Double; IsNull: Boolean);
begin
  if LastNull or IsNull then
  begin
    Series.AddNullXY(X,Y);
    LastNull:=IsNull;
  end
  else
    Series.AddXY(X,Y);
end;

end.
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

rhyden
Newbie
Newbie
Posts: 7
Joined: Wed Aug 18, 2004 4:00 am

Post by rhyden » Wed Mar 14, 2007 5:11 pm

I was able to get it to work. It was a little more difficult since I am using my x-axis to show datetime information. You have to add the null point with the same timestamp as the "newer" point being added to the graph. But it works and I appreciate the help.

Post Reply