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:
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
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
Serious date time axis inconsistencies
Re: Serious date time axis inconsistencies
Hi Henry,
I think that the following example reproduces your problem:
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)
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
- 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,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |