Recent

Author Topic: [Solved] TChart and Date in X Axis  (Read 916 times)

berghem

  • Jr. Member
  • **
  • Posts: 60
[Solved] TChart and Date in X Axis
« on: February 23, 2022, 09:39:07 pm »
Hi all

in my app I  collect a lot od data from my temperature probe and I have to put the value in Y axis and I want put the date in X asset.
I collect data every 60 seconds from a lot days (circa 15 days) and I wont put the date one time per day.
I saw TDateTimeIntevalChartSource but doesn't work I use this commad
Myseries.add(value, DatetoStr(Now)

Can you help me?



« Last Edit: February 24, 2022, 08:59:37 pm by berghem »

wp

  • Hero Member
  • *****
  • Posts: 10060
Re: TChart and Date in X Axis
« Reply #1 on: February 23, 2022, 10:50:04 pm »
I saw TDateTimeIntevalChartSource but doesn't work I use this commad
Myseries.add(value, DatetoStr(Now)
MySeries.Add does not store the date/time of the temperature measurement as X (which is taken as the index of the data point). You should use AddXY(x, y, ...) instead:
Code: Pascal  [Select][+][-]
  1. Myseries.AddXY(Now(), Temperature);

In the attachment you find a tested demo project with lots of comments.

berghem

  • Jr. Member
  • **
  • Posts: 60
[Solved] Re: TChart and Date in X Axis
« Reply #2 on: February 24, 2022, 08:59:19 pm »
Thanks work well!

 

TinyPortal © 2005-2018