X value 0 when it shouldn't

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

X value 0 when it shouldn't

Post by McMClark » Sun Apr 16, 2006 6:59 pm

I used the code

procedure TMultiDBChart.DoClickSeries(Sender: TCustomChart; Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; x, y: Integer);
begin
strX := Series.XValueToText(Series.XValues[ValueIndex]));
strY := Series.YValueToText(Series.YValues[ValueIndex]));
end;

and set Chart1.Series1.XValues.DateTime := True.

The Y value is being assigned but the X value keeps coming up the Date 12/31/1899. Can you suggest something else I might be doing wrong? When I tried just getting the double value using the code dbValue := Series.XValue[ValueIndex], I get 0.

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

Post by Narcís » Tue Apr 18, 2006 10:00 am

Hi McMClark,

This is most likely because of the way you are populating your series. See an excerpt from TDateTime type definition:

The integral part of a Delphi TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of the TDateTime value is fraction of a 24 hour day that has elapsed.

Following are some examples of TDateTime values and their corresponding dates and times:

0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am


It may help you populating your series obtaining the TDateTime values using Delphi's EncodeDate or EncodeDateTime functions.
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

Post Reply