Page 1 of 1

Datetime data, problem

Posted: Thu Jun 02, 2005 1:53 pm
by 9080645
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

Problem, more accurately

Posted: Fri Jun 03, 2005 10:48 am
by 9080645
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

Posted: Tue Jun 07, 2005 7:32 am
by narcis
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.