Page 1 of 1

Using ExactDateTime = True on Week increment doesn't work

Posted: Fri Nov 26, 2004 1:38 pm
by 9082517
Hi,

When using ExactDateTime = True on an axis and the incement is a week the labels displayed doesnt fall on "exact weeks".

Code: Select all

    TChart1.AddSeries scLine
    TChart1.Series(0).AddXY #11/1/2004#, 1, "", 0
    TChart1.Series(0).AddXY #11/8/2004#, 2, "", 0
    TChart1.Series(0).AddXY #11/15/2004 2:00:00 AM#, 4, "", 0
    TChart1.Series(0).AddXY #11/22/2004 3:00:00 AM#, 1, "", 0
    
    TChart1.Axis.Bottom.SetMinMax #11/1/2004#, #11/30/2004#

    'Uncommenting the line below makes the labels display on wrong dates (shows when scrolling).
    'They should be "stable" when the chart is scrolled.
    'If not uncommented, the values are stable at scroll (but then the chart don't display dates of cause)
    'TChart1.Series(0).XValues.DateTime = True

    TChart1.Axis.Bottom.ExactDateTime = True
    TChart1.Axis.Bottom.Increment = 7
Is this a little bug.

Other increments seem to work.

Posted: Fri Nov 26, 2004 4:22 pm
by narcis
Hi FP,
When using ExactDateTime = True on an axis and the incement is a week the labels displayed doesnt fall on "exact weeks".
The increments fall in "exact weeks". You can see it clear adding this line:

Code: Select all

TChart1.Axis.Bottom.MinorTickCount = 6
What it is true is that the labels shouldn't move when scrolling. I have added it in our defect list to be solved for future releases.

Posted: Fri Nov 26, 2004 4:27 pm
by narcis
Hi FP,

I forgot to ask you to post your following messages like this one in the ActiveX forum as you posted VB code.

Posted: Fri Nov 26, 2004 9:48 pm
by 9082517
Sorry about that. An honest mistake.

Posted: Fri Nov 26, 2004 10:00 pm
by 9082517
Ran the code again...

I get labels on 2004-11-02, 2004-11-09, 2004-11-16, 2004-11-23, 2004-11-30.

You are right that is seven days inbetween, but that is tuesdays. I would like the labels to to display on mondays (or whatever days is set to be first day of week).

If I set the increment to be a month (dtOneMonth). Labels display on the 1:st in every month, dont they?

Is it possible to achieve the same behaviour when using weeks?

Posted: Mon Nov 29, 2004 8:50 am
by narcis
Hi FP,

Then the solution would be adding the labels you want using the following code:

Code: Select all

Private Sub TChart1_OnGetNextAxisLabel(ByVal Axis As Long, ByVal LabelIndex As Long, LabelValue As Double, MoreLabels As Boolean)
    If Axis = atBottom Then
        MoreLabels = True
        'Only label if following cases are true
        Select Case LabelIndex
            Case 0: LabelValue = #11/1/2004#
            Case 1: LabelValue = #11/8/2004#
            Case 2: LabelValue = #11/15/2004#
            Case 3: LabelValue = #11/22/2004#
            Case 4: LabelValue = #11/30/2004#
            Case Else: MoreLabels = False
        End Select
    End If
End Sub