Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 252 - [TV52016171] TCHart has trouble handling dates < 1895, only in XE2! The following...
Summary: [TV52016171] TCHart has trouble handling dates < 1895, only in XE2! The follo...
Status: CONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Axis (show other bugs)
Version: unspecified
Hardware: All All
: Normal enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-27 14:48 EDT by yeray alonso
Modified: 2013-11-20 10:34 EST (History)
0 users

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2013-11-20 10:34:40 EST
TCHart has trouble handling dates < 1895, only in XE2!
The following code gives an "invalid floating point operation" error in XE2.
{$I TeeDefs.inc}
uses
  {$IFDEF D16}
  VCLTee.Series;
  {$ELSE}
  Series;
  {$ENDIF}
procedure TForm1.FormCreate(Sender: TObject);
var y:integer;
    sr:tChartSeries;
begin
  sr:=Chart1.AddSeries(TBarSeries.Create(Self));
  sr.XValues.DateTime:=True;
  Chart1.Axes.Bottom.ExactDateTime:=True;
  Chart1.Axes.Bottom.Increment:=DateTimeStep[dtOneYear];
  Chart1.Axes.Bottom.RoundFirstLabel:=True;
  Chart1.Axes.Bottom.DateTimeFormat:='dd/mm/yyyy';
  for y:=1850 to 2012 do
    sr.AddXY(EncodeDate(y,1,1),random(100));  // boum!!
{  for y:=1896 to 2012 do
    sr.AddXY(EncodeDate(y,1,1),random(100));}   // ok
end;
The customer suggests a fix, but it doesn't look very definitive to me:
http://www.teechart.net/support/viewtopic.php?f=3&t=13215&view=unread#p57597
If I understant it well, it actually "truncates" the date between the interval (1/1/1 - 31/12/9999). But what if anyone wants to have a date before Christ? We could do something like:
  if (v < EncodeDate(1,1,1)) then v:=Abs(v-EncodeDate(1,1,1)) and set a "BC" flag to add the BC/AC string to the labels... 
I've tried it but doesn't work for me either <g> :-( [created:2012-04-27T13:48:12.000+01:00 reported by:yeray@steema.com reported in version:2012.05.120327 (TeeChart VCL)]