Page 1 of 1

how to change marks position through code

Posted: Thu Sep 21, 2006 11:48 am
by 6925851
how to change marks position through code ...

how to set marks to my coordinates

Posted: Thu Sep 21, 2006 12:06 pm
by narcis
Hi Aravind,

You can do something like this:

Code: Select all

Private Sub Form_Load()
    TeeCommander1.Chart = tc
    tc.Axis.Left.SetMinMax 50, 130
    
    For i = 0 To tc.SeriesCount - 1
        With tc.Series(i)
            For j = 0 To 20
                'We populate the series with random values ranging from 40 to 150
                .Add ((150 - 40 + 1) * Rnd + 40), "", clTeeColor
            Next j
            
            For ii = 0 To .Count - 1
                If (.YValues.Value(ii) > tc.Axis.Left.Maximum) Then
                    tc.Environment.InternalRepaint
                    yValue = .CalcYPosValue(tc.Axis.Left.Maximum - 5)
                    .Marks.Positions.Position(ii).Custom = True
                    .Marks.Positions.Position(ii).LeftTop.Y = yValue
                    .Marks.Arrow.Visible = False
                Else
                    If (.YValues.Value(ii) < tc.Axis.Left.Minimum) Then
                        tc.Environment.InternalRepaint
                        yValue = .CalcYPosValue(tc.Axis.Left.Minimum + 5)
                        .Marks.Positions.Position(ii).Custom = True
                        .Marks.Positions.Position(ii).LeftTop.Y = yValue
                        .Marks.Arrow.Visible = False
                    End If
                End If
            Next ii
'            .Marks.Clip = True
        End With
    Next i
    
    tc.Repaint
End Sub

this does not work for requirement

Posted: Fri Sep 22, 2006 8:28 am
by 6925851
i want to read the existing marks positions ( because i have given user option to move the marks int he chart).

i need to get the marks positions and redraw on the same position ..

Posted: Fri Sep 22, 2006 8:53 am
by narcis
Hi Aravind,

You can easily place your marks with a position relative to the original one doing something like this:

Code: Select all

                    .Marks.Positions.Position(ii).LeftTop.Y = .Marks.Positions.Position(ii).LeftTop.Y - 10