Page 1 of 1

Datetime on Y-axis behaves strangly

Posted: Fri May 28, 2004 1:33 pm
by 9082051
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 ?

Posted: Fri May 28, 2004 1:38 pm
by Pep
Hi Lauri,

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

Datetime values on Y-Axis

Posted: Mon May 31, 2004 11:06 am
by 9082051
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 ?

Posted: Wed Jun 02, 2004 8:44 am
by Chris
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.