Index

From: Pep
Subject: Re: Strange Behavior of LineSeries.Addxy in TeeChart4
Date: Wed, 16 Nov 2005 08:10:52 +0100
Newsgroup: public.teechart4.activex  

Hi Dirk,

Yes, this is a confirmed bug in TeeChart 4.02 (version shipped with Delphi).
The problem is TeeChart axis drawing algorithm gets confused if all values
have the same value (that's why you get AV error). The workaround is to
disable axis Automatic property if all values are set axis Min/Max value "by
hand" i.e. use SetMinMax(Value-1,Value+1) to set axis range. I suggest you
do this in Series OnAfterAdd event:

var tmpVal : double;

tmpVal := Series1.YValues.MaxValue;

if tmpVal = Series1.YValues.MinValue then
begin
Series1.GetVertAxis.Automatic := false;
Series1.GetVertAxis.SetMinMax(tmpVal-1,tmpVal+1);
end else Series1.GetVertAxis.Automatic := true;

This bug has been fixed in TeeChart v5 and above.

Best Regards !
Josep Lluis Jorge
http://support.steema.com


"Dirk Leistner" wrote in message
news:%23NrvxFh3FHA.3612@TEEPC.Steema.local...
> Hello,
>
> I just upgraded from Delphi5 to Delphi7 (TeeChart Standard 4.04) and I am
> now experiencing a problem when using Series.AddXY.
> It seems that if you add a single point with 'addxy' while XValue>=1818 an
> error occurs.
> This error does not occure when XValue<1818 or two Values are added
> without Application.processMessages!
>
> For testing i created a form in Delphi 7 and added one Chart with
> LineSeries and a button.
> The following code leads to an error (Exception: EInvalid Pointer):
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Series1.AddXY(1818,1);
> end;
>
> whereas these codes do not generate the error:
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Series1.AddXY(1817,1);
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Series1.AddXY(18187,1);
> Series1.AddXY(1819,1);
> end;
>
> Is there a solution for this problem?
>
> Best Regards
> Dirk Leistner
> dirk.leistner@hbm.com
>