Board index » delphi » TChart Real Time Plotting - Midnight problem

TChart Real Time Plotting - Midnight problem

I'm having trouble plotting numbers using TChart if the time passes through
midnight.

I want to chart values in real time.  I have a little sample program that's
plotting random numbers on the screen in real time.  I would like to set my
own Minimum and Maximum x scale ranges ( I' ve already figured that out).
However, whenever the system time passes through midnight the display
freezes.  I think it's just plotting numbers off the scale I have set.

My solution was to leave the x axis on Automatic, but then the display
screws up (starts plotting values at the left of the graph instead of on the
right).  I'm sure people have got around this somehow, but I can't seem to
figure out a clever way of doing it.

I thought another solution would be to use the DateTime function to it's
fullest, that is to add the date and the time together so the x value would
be something like 39451.345 (that's the actual value for a date).  This
would limit the rollover problem to once in a very long time, but T chart
does not display any x axis scale when I ask it to plot this value.  I can
get TChart to display either times, OR dates on the x-axis, but not both.
Any ideas.

Please help.

Cheers Dave Mody
PS  Drop me an e-mail at:  w...@kos.net

 

Re:TChart Real Time Plotting - Midnight problem


Hi David
You should use always TDateTime variable types.
This ensures Y2K compatibility and no limit problems.

You can set an axis to show values as "DateTime",
by setting this:

Series1.XValues.DateTime:=True;

Chart1.BottomAxis.DateTimeFormat:='mm-dd-yyyy';

also the label spacing:

Chart1.BottomAxis.Increment:=DateTimeStep[ dtOneDay ] ;

and the start and end values:

Chart1.BottomAxis.Minimum:=EncodeDate( 2001,6,23 );

all axes can show datetime labels.

--
Regards
David Berneda
http://www.teemach.com

Quote
David Mody wrote in message <79ksf9$ss...@forums.borland.com>...
>I'm having trouble plotting numbers using TChart if the time passes through
>midnight.

>I want to chart values in real time.  I have a little sample program that's
>plotting random numbers on the screen in real time.  I would like to set my
>own Minimum and Maximum x scale ranges ( I' ve already figured that out).
>However, whenever the system time passes through midnight the display
>freezes.  I think it's just plotting numbers off the scale I have set.

>My solution was to leave the x axis on Automatic, but then the display
>screws up (starts plotting values at the left of the graph instead of on
the
>right).  I'm sure people have got around this somehow, but I can't seem to
>figure out a clever way of doing it.

>I thought another solution would be to use the DateTime function to it's
>fullest, that is to add the date and the time together so the x value would
>be something like 39451.345 (that's the actual value for a date).  This
>would limit the rollover problem to once in a very long time, but T chart
>does not display any x axis scale when I ask it to plot this value.  I can
>get TChart to display either times, OR dates on the x-axis, but not both.
>Any ideas.

>Please help.

>Cheers Dave Mody
>PS  Drop me an e-mail at:  w...@kos.net

Re:TChart Real Time Plotting - Midnight problem


David,

I find that with TDateTime variables and e.g. the axis date-time format
'hh:mm', DateTimeStep dtOneHour, and axis minimum and maximum values
spanning midnight, the TChart axis labelling, and grid lines, stop at
midnight, though the series is plotted correctly.

Any suggestions?

Thanks

Trevor Cooper

Quote
David Berneda wrote:

> Hi David
> You should use always TDateTime variable types.
> This ensures Y2K compatibility and no limit problems.

> You can set an axis to show values as "DateTime",
> by setting this:

> Series1.XValues.DateTime:=True;

> Chart1.BottomAxis.DateTimeFormat:='mm-dd-yyyy';

> also the label spacing:

> Chart1.BottomAxis.Increment:=DateTimeStep[ dtOneDay ] ;

> and the start and end values:

> Chart1.BottomAxis.Minimum:=EncodeDate( 2001,6,23 );

> all axes can show datetime labels.

> --
> Regards
> David Berneda
> http://www.teemach.com

Re:TChart Real Time Plotting - Midnight problem


Hi Trevor
A bug related to this was fixed in 4.01 version. Do you use this one?
It can be also the range of your values? (I mean, the 00:01 of the next-day
is a bigger datetime value than 23:59 of current).

--
Regards
David Berneda
http://www.teemach.com

Quote
trevor.cooper1 wrote in message <36C6CA52.7...@{*word*269}.net>...
>David,

>I find that with TDateTime variables and e.g. the axis date-time format
>'hh:mm', DateTimeStep dtOneHour, and axis minimum and maximum values
>spanning midnight, the TChart axis labelling, and grid lines, stop at
>midnight, though the series is plotted correctly.

>Any suggestions?

>Thanks

>Trevor Cooper

>David Berneda wrote:

>> Hi David
>> You should use always TDateTime variable types.
>> This ensures Y2K compatibility and no limit problems.

>> You can set an axis to show values as "DateTime",
>> by setting this:

>> Series1.XValues.DateTime:=True;

>> Chart1.BottomAxis.DateTimeFormat:='mm-dd-yyyy';

>> also the label spacing:

>> Chart1.BottomAxis.Increment:=DateTimeStep[ dtOneDay ] ;

>> and the start and end values:

>> Chart1.BottomAxis.Minimum:=EncodeDate( 2001,6,23 );

>> all axes can show datetime labels.

>> --
>> Regards
>> David Berneda
>> http://www.teemach.com

Re:TChart Real Time Plotting - Midnight problem


Make sure you are using a full date time( date and time) for the bottom
axis and your point values.  This can get you into trouble.
Quote
trevor.cooper1 wrote:

> David,

> I find that with TDateTime variables and e.g. the axis date-time format
> 'hh:mm', DateTimeStep dtOneHour, and axis minimum and maximum values
> spanning midnight, the TChart axis labelling, and grid lines, stop at
> midnight, though the series is plotted correctly.

> Any suggestions?

> Thanks

> Trevor Cooper

> David Berneda wrote:

> > Hi David
> > You should use always TDateTime variable types.
> > This ensures Y2K compatibility and no limit problems.

> > You can set an axis to show values as "DateTime",
> > by setting this:

> > Series1.XValues.DateTime:=True;

> > Chart1.BottomAxis.DateTimeFormat:='mm-dd-yyyy';

> > also the label spacing:

> > Chart1.BottomAxis.Increment:=DateTimeStep[ dtOneDay ] ;

> > and the start and end values:

> > Chart1.BottomAxis.Minimum:=EncodeDate( 2001,6,23 );

> > all axes can show datetime labels.

> > --
> > Regards
> > David Berneda
> > http://www.teemach.com

Other Threads