After I have created some series and groups in a teechart, I clear the chart, and add them once again. When I loop the AddSeries first time it went well, but second time I got an error:
-2147418113, "Invalid pointer operation"
I'm using TeeChart Pro Activex Control v8
v8.0.0.4
It seemse that my series count increment by one each time, even when I got the error.
Hope any one can give me clue, what can goes wrong, since I do not under stand it !
Regards
Kasper
Code: Select all
Set myChart = TChart1
For n = 0 To 2
seriesCount = myChart.seriesCount
myChart.AddSeries scLine
myChart.Series(seriesCount).asLine.Pointer.Visible = True
myChart.Series(seriesCount).asLine.Pointer.HorizontalSize = 2
myChart.Series(seriesCount).asLine.Pointer.VerticalSize = 2
myChart.Series(seriesCount).asLine.LinePen.width = 1
myChart.Series(seriesCount).Clear
myChart.Series(seriesCount).Active = True
myChart.Series(seriesCount).XValues.DateTime = True
myChart.Series(seriesCount).Title = "some title"
If (n = 0) Then
' add graph/serie to the group to be shown in list box
myChart.SeriesList.Groups.Items(0).Add seriesCount
else
myChart.Series(seriesCount).color = vbRed
myChart.Series(seriesCount).Active = False
myChart.Series(seriesCount).asLine.Stairs = True
End If
If n = 2 Then
groupCount = myChart.SeriesList.Groups.count
myChart.SeriesList.AddGroup groupCount
'myChart.Series(seriesCount - 1).Title = "abc"
'myChart.Series(seriesCount).Title = "abc"
End If
Next