Recent

Author Topic: Time base axis  (Read 1773 times)

LemonParty

  • Jr. Member
  • **
  • Posts: 88
Time base axis
« on: July 09, 2024, 11:52:17 am »
Is it possible to make the bottom axis like on screenshot? The axis marks should be time marks.

wp

  • Hero Member
  • *****
  • Posts: 12466
Re: Time base axis
« Reply #1 on: July 09, 2024, 12:16:27 pm »
You mean you want to draw the red markers as axis marks? Oder do you mean to have a time scale?

LemonParty

  • Jr. Member
  • **
  • Posts: 88
Re: Time base axis
« Reply #2 on: July 09, 2024, 12:27:00 pm »
Time scale.

wp

  • Hero Member
  • *****
  • Posts: 12466
Re: Time base axis
« Reply #3 on: July 09, 2024, 07:03:51 pm »
Use TDate/TDateTime/TTime values for x. Add a TDateTimeChartSource to the form and assign it to the Marks.Source of the chart's BottomAxis. Then also set Marks.Style to smsLabel. Now you have a date/time axis. The units adjust automatically to the range plotted on x. If labels are overlapping, increase the DateTimeChartSource.Params.MaxLength.

See attached mini project.

LemonParty

  • Jr. Member
  • **
  • Posts: 88
Re: Time base axis
« Reply #4 on: July 09, 2024, 07:53:56 pm »
This is what I wanted. Thank you very much.

LemonParty

  • Jr. Member
  • **
  • Posts: 88
Re: Time base axis
« Reply #5 on: July 25, 2024, 08:43:52 am »
One more question. On the screenshot time is in format DD/MM. Is it possible to make it MM/DD?
« Last Edit: July 25, 2024, 10:04:30 am by LemonParty »

wp

  • Hero Member
  • *****
  • Posts: 12466
Re: Time base axis
« Reply #6 on: July 25, 2024, 10:50:02 am »
The simple way is to change the "DateTimeFormat" property of the DateTimeIntervalChartSource: change it to mm/dd for your month-first format.

However, this has the disadvantage that, when you zoom into the chart, always the same format will be used, even if the zoomed range is only a few hours. Better to look at the "DateTimeStepFormat" entries where every date/time unit has its own format. According to your screenshot you probably are in the "DayFormat" or "WeekFormat" region - change them to mm/dd. You may also want to change the "MonthFormat" to yyyy/mm to begin the labels with the year.

LemonParty

  • Jr. Member
  • **
  • Posts: 88
Re: Time base axis
« Reply #7 on: July 26, 2024, 02:39:46 pm »
Thank you. Editing DateTimeStepFormat do the thing.

 

TinyPortal © 2005-2018