Datetime on Y-axis behaves strangly

TeeChart for ActiveX, COM and ASP
Post Reply
Lauri Kari
Newbie
Newbie
Posts: 4
Joined: Tue Apr 13, 2004 4:00 am
Location: Finland
Contact:

Datetime on Y-axis behaves strangly

Post by Lauri Kari » Fri May 28, 2004 1:33 pm

I'm using TChart 6.0 ActiveX to display a value profile in ColorGrid -series, but adding datetime values as Y-values results in strange scaling ranging always one day forward from the last of the dates. The values are shown in wrong coordinate positions.
Is there something special that needs to be taken care of when using datetimes in Y-axis ?
If I format the label as not datetime the values are ranging to area of 1 in variant datetime format which not is correct according to the specifications. If I use the a file or debugger to show datevalues before adding to TChart they are shown and ranging correctly.
What could be wrong ?

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri May 28, 2004 1:38 pm

Hi Lauri,

could you please post an example in the steema.public.attachments newsgroups with which I can reproduce "as-is" the problem here ?

Lauri Kari
Newbie
Newbie
Posts: 4
Joined: Tue Apr 13, 2004 4:00 am
Location: Finland
Contact:

Datetime values on Y-Axis

Post by Lauri Kari » Mon May 31, 2004 11:06 am

Hi !
This code demonstrates the Y-Axis datetime behaviour. The calculated D-value ranges from 0 to 2 in days. The axis gets labeled 3 days instead of 2 and the data shown is not correct. If you change the code to use the commented row instead and the whole number Y the colorgrid is shown correctly. Please try this code.

Private Sub Draw_Chart1()
Chart1.ClearChart
Chart1.AddSeries (scColorGrid)
Chart1.Aspect.View3D = False
Chart1.Series(0).asColorGrid.UseColorRange = True
Chart1.Series(0).asColorGrid.StartColor = RGB(255, 0, 0)
Chart1.Series(0).asColorGrid.MidColor = RGB(255, 128, 0)
Chart1.Series(0).asColorGrid.EndColor = RGB(255, 255, 0)
Chart1.Series(0).asColorGrid.UsePalette = True
Chart1.Series(0).Pen.Visible = False
Chart1.Series(0).YValues.DateTime = True
Chart1.Visible = False
Chart1.Axis.Left.Labels.DateTimeFormat = "yyyy-mm-dd hh:nn:ss"

Dim X
Dim Y
Dim Z
Dim C
Dim D

For Y = 1 To 2880
D = Y / 1440
For X = 1 To 60
Z = Sin(X / 10) - Cos(Y / 750) + Sin((X + Y) / 250)
C = RGB(255, Z * 30 + 127, 0)
Chart1.Series(0).asColorGrid.AddXYZ X, Z / 10 + 20, D, X, C
'Chart1.Series(0).asColorGrid.AddXYZ X, Z / 10 + 20, Y, X, C
Next
Next
Chart1.Visible = True
End Sub

Have you any idea for the cause of the misbehaviour ?

Shouldn't the time function as described from 1/1440 to 2 days equally distributed ?

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Jun 02, 2004 8:44 am

Hi
Have you any idea for the cause of the misbehaviour ?

Shouldn't the time function as described from 1/1440 to 2 days equally distributed ?
I'm not sure; I'll look into it and get back to you as soon as I have something.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply