Page 1 of 1
TFastLineSeries displays null point
Posted: Tue Mar 13, 2007 11:07 pm
by 9338657
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?
Posted: Wed Mar 14, 2007 10:25 am
by yeray
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.
Posted: Wed Mar 14, 2007 5:11 pm
by 9338657
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.