Recent

Author Topic: Chart with actual time on X axis set to hh:nn will not work  (Read 2267 times)

brown_rb

  • Newbie
  • Posts: 2
Chart with actual time on X axis set to hh:nn will not work
« on: April 09, 2020, 04:23:28 am »
Hi
I am trying to add values to a simple line chart/ But the time displayed using DateTimeIntervalChartSource does not bear any resemblence to the actual computer time.

I searched the forum and downloaded an example. But that example also shows the time as meaningless values which do not represent the time of the sample in hours and minutes

I need a chart where the x value is a data point and the y value is a time stamp in hh:nn or hh:nn:ss where the time is the actual time.

I attach the example I downloaded and modified. But again, it does not work. Data points are added via a timer, but the y axis is totally meaningless.

I do not want to zoom the chart. I know how to delete points so that part is no issue. It is displaying the time correctly. I would expect the first data point on Y to be the actual time hh:mm:ss of the computer, and the same for the next data point etc. Why isnt that so.

I do charts in Windows all the time without issue (VS). I just cannot see why it is so complicated here. I must be missing something obvious

Any help appreciated
Robert
« Last Edit: April 09, 2020, 04:42:23 am by brown_rb »

wp

  • Hero Member
  • *****
  • Posts: 12471
Re: Chart with actual time on X axis set to hh:nn will not work
« Reply #1 on: April 09, 2020, 09:50:57 am »
You seem to have blindly modified the demo without knowing what you are doing.

When you want current time on the y axis you must pass it as second parameter to the Series.AddXY(x,y) call - you passed it as the first parameter.

When you want a time variable to be displayed in proper time units you need a TDateTimeIntervalChartSource attached to the corresponding axis. This is available in your demo, but it is attached to the x axis, not the y axis (this was correct on the original demo where time was on x - but now time is on y).

Don't play with the Steps of the DateTimeIntervalChartSource. This property is a bit counter-intuitive because it is used to SUPPRESS labels when a step element is not checked.

See a working modification of the demo in the attachment.

brown_rb

  • Newbie
  • Posts: 2
Re: Chart with actual time on X axis set to hh:nn will not work
« Reply #2 on: April 09, 2020, 11:29:54 am »
Actually you misunderstood. The title of the question said it all. I want time on the X axis. Your example does not do that. I have no use it being on Y axis, that is just stupid.

I can do this in less than 5 minutes in Visual Studio. Easy peasy.

yes I stuffed around with values trying to get the damn thing to work. I even spent the best part of the day searching the internet and this forum for examples, every one I found did not work. Why is it that there is a not a single example anywhere which does this? I suspect either it is too hard, people gave up and went to some other solution, or it just plain cannot be done.

If I had wanted it on Y axis then the title would have said so. It did not. Please do not offer me a solution that is not in line with my requirements or request. I asked for help, not to be berated for being told I know jack shit or being offered a solution that does not come close to what I requested.

Thank you for your time.

wp

  • Hero Member
  • *****
  • Posts: 12471
Re: Chart with actual time on X axis set to hh:nn will not work
« Reply #3 on: April 09, 2020, 11:58:48 am »
Actually you misunderstood. The title of the question said it all. I want time on the X axis. Your example does not do that. I have no use it being on Y axis, that is just stupid.
And what is this:
I need a chart where the x value is a data point and the y value is a time stamp in hh:nn or hh:nn:ss where the time is the actual time.

Please do not offer me a solution that is not in line with my requirements or request. I asked for help, not to be berated for being told I know jack shit or being offered a solution that does not come close to what I requested.
Please don't complain about an inappropriate answer if you give contradicting information. But really, what is the problem generalizing my solution such that you apply  everything that I did with the x axis to the y axis, and vice versa?

 

TinyPortal © 2005-2018