Search code examples
delphidelphi-xe7teechart

TChart axis scaled by hours of the day


I've been trying for about an hour now fiddling with the TChart's Left Axis to make it show the hour of the day.

For example...

  • 8:00 PM
  • 6:00 PM
  • 4:00 PM
  • 2:00 PM
  • 12:00 AM
  • 10:00 AM
  • 8:00 AM

In the back-end, I have a 24-hour day range (0 - 24) for the Minimum / Maximum. I've tried setting the Left Axis Label Value Format to h:nn AM/PM, but to no avail. It just displays that exact formatting text instead of any realistic data.

How do I make the TChart's left axis display an hourly range of the time of day?


Solution

  • You may need to set series YValues to datetime, for example:

      Chart1[0].YValues.DateTime := True;
    

    You can also set this at design time here :

    enter image description here