Zoom to chart date time range

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Zoom to chart date time range

Post by bdw » Wed Dec 20, 2017 6:01 am

Hello,

I have a chart that has a bottom axis date range 2013-10-28 to 2017-12-20 as the maximum range.

How can I change the range to for example 5 days. 1 month, 1 year, 2 years, 5 years etc.

So it would always show from the current time on the right hand side to for example 1 year on the left hand side ?

Can't seem to get the SetMinMax to work for me.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zoom to chart date time range

Post by Yeray » Wed Dec 20, 2017 2:41 pm

Hello,

I've modified a little bit the example here, adding a combobox where you can select to show last n points (where n an be 5 days, 1 month - 30 points, 1 year - 365 points or 2 years):
ShowLastNPoints.zip
(83.29 KiB) Downloaded 983 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: Zoom to chart date time range

Post by bdw » Thu Dec 21, 2017 4:10 am

Thanks Yeray.

The example was enough to show me that my code should have been working.

After looking at it further I'm using a TCandleSeries and was using the Minimum value but that appears to be some date in the 1900's ?

So I can't set a TDateTime value for it, maybe I'm missing something ?

I can get it to work by subtract my date value from Minimum but not sure what its in the 1900's

Yep that solved it.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zoom to chart date time range

Post by Yeray » Mon Jan 08, 2018 10:29 am

Hello,

This probably explains the 1900:
http://www.delphibasics.co.uk/RTL.asp?Name=TDateTime
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply