Page 1 of 1

Dates before 1900

Posted: Mon Mar 05, 2007 2:04 pm
by 9349350
I need to show dates before 1-1-1900, (back to 1-1-1850!)

Is there a specific reason why Function TChartAxis.LabelValue

says

if Value>=0 then...

It makes it impossible to display dates before 1-1-1900

(I had to patch it in teechart sourcecode)

Posted: Mon Mar 05, 2007 2:39 pm
by narcis
Hi Hans,

Yes, this is because TDateTime's implementation in the VCL as you can see in Delphi's help files.

However, you could use something like this unit.

Easy patch

Posted: Mon Mar 05, 2007 2:44 pm
by 9349350
All I did was replace the if aDate>0 then... by
if True then...

And it works like a charm. When using negative date values now,
labels are omitted until 1900 and then displayed... ???
:?

Posted: Mon Mar 05, 2007 3:34 pm
by narcis
Hi Hans,

Ok, thanks for the information.

In that case you can add the labels using Add method's override Add(YValue,Label,Color) or AddXY(XValue,Label,Color). Another option would be customizing the labels in the OnGetAxisLabel event.

I know..

Posted: Mon Mar 05, 2007 3:42 pm
by 9349350
But I'd rather be able to display dates before 1900 as default behavior than having to write an event handler for this in every spot where I use TCharts.

(Over 300!) :shock:

I uploaded word document with example

Posted: Mon Mar 05, 2007 4:09 pm
by 9349350
I just applied the
"If True" Patch

Check out Pre_1900_Dates.doc

which I just uploaded.