Page 1 of 1

Cannot calc Y position and marks positions

Posted: Fri Nov 19, 2004 9:37 am
by 9523619
Having a bit of a weird one where the bar marks are not correctly positioned above bars i.e. they are overlapping.

so.. i'm trying to run this bit of code to move them:

BarTop = .Series(1).CalcYPos(i)
BarBottom = .Series(1).CalcYPosValue(i)
ypos = (BarTop + BarBottom) / 2
.Series(1).Marks.Positions.Position(i).Custom = True
.Series(1).Marks.Positions.Position(i).LeftTop.Y = ypos

i'm looping through a recordset, incrementing 'i' through each loop.

BarTop and BarBottom = "0" and the code fails on .Series(1).Marks.Positions.Position(i)....

i've replaced (i) with 1,2 etc and I still get the same.

Is it something simple that i've done wrong?

Thanks

Posted: Mon Nov 22, 2004 7:41 am
by Pep
Hi,

the following code works fine :

Code: Select all

Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scBar
    .Series(0).FillSampleValues (5)
    .Series(0).Marks.Visible = True
    .Series(0).Marks.Arrow.Visible = False
    .Environment.InternalRepaint
    For i = 0 To .Series(0).Count - 1
        BarTop = .Series(0).CalcYPos(i)
        BarBottom = .Series(0).CalcYPosValue(i)
        ypos = (BarTop + BarBottom) / 2
        .Series(0).Marks.Positions.Position(i).Custom = True
        .Series(0).Marks.Positions.Position(i).LeftTop.Y = ypos
    Next i
End With
End Sub