Datetime data, problem

TeeChart for ActiveX, COM and ASP
Post Reply
Mike
Newbie
Newbie
Posts: 40
Joined: Wed Jan 28, 2004 5:00 am

Datetime data, problem

Post by Mike » Thu Jun 02, 2005 1:53 pm

hi,

I'm having troubles with setting x-axis datetime range. I want to set the min value to the first timestamp of my data, and set the maximum value to min + 15 mins, for example. How do I do that?

I've tried to use the VBScript FormatDateTime and DateAdd functions, but with no luck. In which format should I enter the datetime values, when using the FormatDateTime function?

I'm using TeeChart 6.0.0.5 with ASP pages (VBScript).

Thanks in advance!

Mike

Mike
Newbie
Newbie
Posts: 40
Joined: Wed Jan 28, 2004 5:00 am

Problem, more accurately

Post by Mike » Fri Jun 03, 2005 10:48 am

hello again,

the problem in more detail is that when using .SetMinMax function, it does not approve DateTime values formatted with VBScript's FormatDateTime function. The chart actually stops drawing the data totally.

How can I set the minimum and maximum values to x-axis (datetime format) so that e.g. the minimum is 1.1.2005 12:00:00 and the maximum is set to e.g. 1 hour from the minimum, that is, 1.1.2005 13:00:00?

The maximum value should also be changeable, say the user can set it to some predefined value (= dropdown box).

Thanks in advance,

Mike

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 07, 2005 7:32 am

Hi Mike,

What you request can be easily done using:

Code: Select all

Private Sub Form_Load()
    With TChart1.Series(0)
        .FillSampleValues 10
        .XValues.DateTime = True
    End With
    
    With TChart1.Axis.Bottom.Labels
            .DateTimeFormat = "dd/mm/yyyy hh:mm:ss"
            .Angle = 90
    End With
    
    TChart1.Axis.Bottom.Increment = TChart1.GetDateTimeStep(dtOneDay)
    TChart1.Environment.InternalRepaint
    TChart1.Axis.Bottom.SetMinMax TChart1.Series(0).XValues.Minimum, TChart1.Series(0).XValues.Minimum + 15
End Sub

If you want to use that for real-time charting, and always displaying the same number of days in the axis but incrementing the date you should also use SetMinMax at OnAfterDraw event.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply