Serious date time axis inconsistencies

TeeChart for ActiveX, COM and ASP
Post Reply
Henry
Newbie
Newbie
Posts: 1
Joined: Thu Dec 24, 2009 12:00 am

Serious date time axis inconsistencies

Post by Henry » Mon Dec 28, 2009 8:50 pm

Hi Im using Techart Active X v7.0.1.4. It’s hard to understand how Teechart is handling date series!
In my sample there are 120 month end date points. I insert them into the chart with the Addxy() method.
1 ) Problem showing values on the bottom axis increment 1 Year:
Tee_DateAxis_bug.gif
Date values 1 year
Tee_DateAxis_bug.gif (27.91 KiB) Viewed 3348 times
As you can see on the bottom axis the correct dates are not shown. I wonder also where the minimum value is coming from?

2) Problem showing values with 12 points
Tee_DateAxis_bug365.gif
Date values 12 points
Tee_DateAxis_bug365.gif (14.39 KiB) Viewed 3350 times
3) When using string as labels, I can’t use the point method

The only way how I can correctly format and show date values is with the ongetaxislabel event (Powerbuilder code
Ii_step=12
if mod(valueindex,ii_step)>0 then labeltext=""end if )

I honestly don’t understand the logic. The data table shows the correct dates, but the bottom axis shows only garbage. It’s also hard to understand that XY lables are correctly presented-
I’m really shaking my head, I thought that Teechart is a mature product.
Thanks in advance for any comments
Henry

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Serious date time axis inconsistencies

Post by Yeray » Tue Dec 29, 2009 2:52 pm

Hi Henry,

I think that the following example reproduces your problem:

Code: Select all

Private Sub Form_Load()  
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scLine
  TChart1.Series(0).XValues.DateTime = True
  
  Dim mymonth, myyear As Integer
  Dim mydate As Date
  For myyear = 2009 To 2010
    For mymonth = 1 To 12
      If mymonth = 2 Then
        mydate = "28/" & Str$(mymonth) & "/" & Str$(myyear)
      Else
        If (mymonth = 1) Or (mymonth = 3) Or (mymonth = 5) Or (mymonth = 7) Or (mymonth = 8) Or (mymonth = 3) Or (mymonth = 12) Then
          mydate = "31/" & Str$(mymonth) & "/" & Str$(myyear)
        Else
          mydate = "30/" & Str$(mymonth) & "/" & Str$(myyear)
        End If
      End If
      TChart1.Series(0).AddXY mydate, mymonth + (myyear - 2009) * 12, Str$(mydate), clTeeColor
    Next mymonth
  Next myyear
  
  TChart1.Series(0).Marks.Visible = True
  TChart1.Series(0).Marks.Style = smsXY
  TChart1.Axis.Bottom.Labels.Style = talValue 'talText
End Sub
Note that TeeChart calculates internally the labels to show trying to show as many labels as possible. You can:

- Change the bottom axis bottom style to talText. This will force the bottom axis to show the labels stored with the series values (hiding the necessary labels to avoid overlapping).
So you'll need to add your values with label (or assign them manually once added) or use OnGetAxisLabels event to format your axis labels text.

- Use custom labels. You can clear all the bottom axis labels and add as many as you want manually (TChart1.Axis.Bottom.Labels.Clear and TChart1.Axis.Bottom.Labels.Add methods)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply