EOverflow exception while loading a data to Chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
arthemy
Newbie
Newbie
Posts: 5
Joined: Thu Sep 07, 2006 12:00 am

EOverflow exception while loading a data to Chart

Post by arthemy » Fri Nov 24, 2006 11:44 am

Hello.

I have a problem with loading "zero" values to TeeChart. EOverflow exception raising when data contains only "zero" values. It's raise at line 2695 {TeEngine.pas}

Code: Select all

Procedure TChartAxis.InternalCalcRange;
begin
  IRange:=IMaximum-IMinimum;
  IRangeZero:=IRange=0;
  if IRangeZero then IAxisSizeRange:=0
                       else IAxisSizeRange:=IAxisSize/IRange; {line 2695}
when IRange is very small (like IRange = 4.0403223612e-311), then result of IAxisSize/IRange is very big (more then MaxDouble). As the result is rasing of EOverflow exception.

I think it's can be correct this way:

Code: Select all

Procedure TChartAxis.InternalCalcRange;
begin
  IRange:=IMaximum-IMinimum;
  IRangeZero:=IRange=0;
  if IRangeZero then IAxisSizeRange:=0
  else
    try
      IAxisSizeRange:=IAxisSize/IRange;
    except
      on E: EOverflow do
        IAxisSizeRange := MaxDouble;
      else
        raise
    end;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 24, 2006 12:25 pm

Hi arthemy,

Which TeeChart version are you using? Could you please send us some code or a simple example we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

arthemy
Newbie
Newbie
Posts: 5
Joined: Thu Sep 07, 2006 12:00 am

Post by arthemy » Fri Nov 24, 2006 12:52 pm

I'm usinng TeeChart 7.07 Pro with source

For regret, I can't connect to news://www.steema.net/steema.public.attachments newsgroup.

The example is very simple. It's a form with TeeChart and button.

Code: Select all

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TBarSeries;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Math;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  x,y: Double;
begin
  Series1.Clear;
  X := 100;
  Y := MinDouble;
  for i := 0 to 1000 do
  begin
    Series1.AddXY(X,Y);
    X := X + i/1000; 
  end;
end;

end.

Post Reply