Page 1 of 1

Zoom to chart date time range

Posted: Wed Dec 20, 2017 6:01 am
by 9236183
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.

Re: Zoom to chart date time range

Posted: Wed Dec 20, 2017 2:41 pm
by yeray
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 836 times

Re: Zoom to chart date time range

Posted: Thu Dec 21, 2017 4:10 am
by 9236183
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.

Re: Zoom to chart date time range

Posted: Mon Jan 08, 2018 10:29 am
by yeray
Hello,

This probably explains the 1900:
http://www.delphibasics.co.uk/RTL.asp?Name=TDateTime