Hi User1,
Adding values with AddXY method gives you the opportunity to control where exactly in the axis will be drawn each bar. And I think that's what you need.
If you set the bottom axis to be DateTime, you still have to control the separation between one bar and the next one as DateTimes are in fact doubles. It's the expected behaviour to see more separation between two bars with a weekend increment in XValue than between two consecutive days bars.
Adding the date as XValue (or adding Null values), doesn't allow you to control this separation. That's why I recommend you to use a variable to control the XValue and increment its value in one unit from Friday to Monday, the same as from Monday to Tuesday.
And when you want to add a gap between bars (for example to showing that there is no data in a month) you simply have to increment the XValue in more units.
Code: Select all
Private Sub Form_Load()
TeeCommander1.ChartLink = TChart1.ChartLink
TeeCommander2.ChartLink = TChart2.ChartLink
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
TChart2.Aspect.View3D = False
TChart2.Legend.Visible = False
TChart1.AddSeries scBar
TChart2.AddSeries scBar
Dim XValue, YValue As Double
Dim i As Integer
Dim myDate As Date
XValue = 0
myDate = DateValue("01/01/2010")
For i = 0 To 89
If Weekday(myDate) <> vbSaturday And Weekday(myDate) <> vbSunday Then
YValue = Rnd * 100
If Month(myDate) <> 2 Then
TChart1.Series(0).AddXY XValue, YValue, Str$(myDate), clTeeColor
End If
TChart2.Series(0).AddXY XValue, YValue, Str$(myDate), clTeeColor
XValue = XValue + 1
End If
myDate = myDate + 1
Next i
TChart1.Environment.InternalRepaint
TChart2.Environment.InternalRepaint
TChart1.Series(0).asBar.BarWidth = TChart2.Series(0).asBar.BarWidth
End Sub

- Bars.png (84.81 KiB) Viewed 11733 times
So adding the following to the code above doesn't affect the result:
Code: Select all
TChart1.Series(0).XValues.DateTime = True
TChart2.Series(0).XValues.DateTime = True
If you need a more precise example, please try to arrange a simple example project we can run as-is to reproduce the behaviour here, showing us something similar to the two charts you are trying to obtain and the tool you are using.